2

I keep getting an error when I try to run any code with strings. When I tried running it through CMD, it gave an error window saying

The procedure entry point _ZNKSt7_cxx1112basic_stringlcSt11char_traitslcESalcEE6substrEjj could not be located in the dynamic library (code file directory)".

Here's the code:

    #include <iostream>
    #include <string>

    int main()
    {
        std::string line1 = "Hello";
        std::cout << line1 << std::endl;
    }
Ken White
  • 123,280
  • 14
  • 225
  • 444
  • What command are you using to execute the code? – GokuMizuno Jan 17 '20 at 01:21
  • 2
    You should put `return 0;` right behind `std::cout << line1 << std::endl;`. – KaiserKatze Jan 17 '20 at 01:24
  • 4
    `3 221 225 785` in hex is `0xC0000139` I now think your problem is a mismatched runtime. Meaning you probably have an older version of your compiler's runtime in one of the folders listed in your windows `PATH` environment variable. – drescherjm Jan 17 '20 at 01:28
  • You get a similar error when you compile C++ with `clang` instead of `clang++` because the C++ standard library isn't linked. – Indiana Kernick Jan 17 '20 at 01:56
  • https://stackoverflow.com/a/47295060/1505939 – M.M Jan 17 '20 at 02:08
  • Did it actually say "[...] located in the dynamic library (code file directory)" or is that your editing? It would be better to post the exact message – M.M Jan 17 '20 at 02:09
  • The "code file directory" is my editing, but I found a solution using the links above. Thanks. – Ehraaz Atif Jan 17 '20 at 03:52

0 Answers0