2

I am just trying to make a simple string variable and c++ giving me dynamic link library error I compile it with

g++ (file_name.cpp) -o (file_name)

And It's giving me this error prompt

The procedure entry point _ZNSt7_cxx1112basic_stringlcSt11char_traitslcESalcEEC1Ev could not be located in the dynamic link library D:\Programs\Testing\String.exe(My C file with full path)

#include<iostream>
#include<string>

using namespace std;

int main(){
    string data;

    return 0;
}

Here is the image:enter image description here

  • 1
    Please post the error message and the command(s), which create it, as plain text here. – ruohola Jun 10 '19 at 09:14
  • 2
    You get these kind of issues when linking to the wrong dll file. Posting a link containing a similar issue: https://stackoverflow.com/questions/54386599/entry-point-not-found-error-on-running-c-exe-file-after-compiling-with-mingw – Indranil Jun 10 '19 at 11:13
  • Thank you, Indranil -static-libstdc++ this command works but I already work with many string operations but they work perfectly so why I am getting this type of error now can you give me a permanent solution Instead of this command –  Jun 10 '19 at 15:49
  • the other way is to take the dll from the compiler directory and copy it to the .exe file, e.g. as in this answer https://stackoverflow.com/a/40110895/10316011 –  Jun 10 '19 at 16:46
  • You can easily get this from using the wrong language version when compiling; note the “cxx11” in the message. – Davis Herring Jun 11 '19 at 00:34

0 Answers0