mingw64 - The procedure entry point _ZNKSt7_cxx1112basic_stringlcSt11char_traitslcESalcEE7compareERKS$_ could not be located in the dynamic link library

166 views
Skip to first unread message

JS

unread,
Sep 1, 2017, 9:20:08 AM9/1/17
to PPP-public
I am a newbie and this happens to me when I build this example program in Codelite with mingw64 32bit. It's very frustrating since I don't understand what is happening. I am guessing it has to be a problem with the headers file? I tested to see if it was my compiler's fault by running a simple hello world program, it runs ok with no errors. So I guess this problem may be unrelated to the compiler, however I am not sure. I really need your help please, this problem has stumped me for a long time. .
#include "../std_lib_facilities.h"

int main()
{
   
string s1 = " ";
   
string s2 = " ";
   
string s3 = " ";
   
string smallest = " ";
   
string middle = " ";
   
string largest = " ";
    cout
<< "Enter three strings separated by spaces\n";
    cin
>> s1 >> s2 >> s3;
   
if (s1 <= s2) {
       
if (s1 <= s3) {
        smallest
= s1;
       
if (s2 <= s3) {
                middle
= s2;
                largest
= s3;
           
}
           
else {
                middle
= s3;
                largest
= s2;
           
}
       
}
       
else {
            smallest
= s3;
            middle
= s1;
            largest
= s2;
       
}
   
}
   
else {
       
if (s1 > s3) {
            largest
= s1;
           
if (s2 <= s3) {
                smallest
= s2;
                middle
= s3;
           
}
           
else {
                smallest
= s3;
                middle
= s2;
           
}
   
}
       
else {
            largest
= s3;
            middle
= s1;
            smallest
= s2;
       
}
   
}
    cout
<< smallest << ", " << middle << ", " << largest << '\n';
}


csrss_2017-09-01_17-30-52.png

Christiano

unread,
Sep 1, 2017, 5:32:29 PM9/1/17
to PPP-public
Your environment is not configured properly.
It is a problem with linking: it is not being able to locate libraries or there is a mismatch between your compiled code and the libraries (conflict 32/64 bits).

Solution:
1- Configure the path of libs correctly
2- Compile your code using same architecture than libs.

JS

unread,
Sep 2, 2017, 2:53:22 AM9/2/17
to PPP-public
Sorry but I really don't understand what you mean. What do you mean by the problem with linking? What libraries are being located and how is there a mismatch of between my code and the libraries?

Here is what I know:
I have setup my PATH to C:\mingw32\bin where all the tools are in.
std_lib_facilities.h is included outside my coding workspace. (#include ../std_lib_facilities.h)
I am using mingw64 [i686-w64-mingw32] and my windows is 64 bit.


Sorry for being stupid, please help me out. 

Christiano

unread,
Sep 2, 2017, 4:16:14 AM9/2/17
to PPP-public
1- Download the latest version of codelite
2- Run the codelite's wizard setup and select Install
3- Choose Mingw-TDM/64bits
4- It will open Download page, download it
5- Run the tdm-gcc......exe installer
6- Select mingw-w64
7- Install
8- Return to codelite
9- Click Scan (wizard setup)
10- Create project
11- Console >> Simple executable ( g++  )
12- In the final, select TDM-gcc as compiler
13- put the the program in main.cpp and add std_lib_facilities.h

Press Ctrl+F5

In my computer was simple like that. Windows 64-bits as well.

Christiano

unread,
Sep 2, 2017, 4:35:01 AM9/2/17
to PPP-public
"Compilation" has two steps:

Compilation:
source --> objects

Linking:
object1 + object2 + object3 + ... =  Final software
where objectN can be embedded on final software or not.

Example:

You have a software which uses library Qt, suppose qt is installed in directory /usr/local/lib
You can link your software with Qt so that it doesn't embed QT, instead it has an "entry point" saying where Qt is installed.

Your program uses standard library which is present in all standard C++ compilers and it is not being able to link properly.

For this reason I knew it was a linking problem.

Follow the steps above.
 
On Saturday, September 2, 2017 at 3:53:22 AM UTC-3, JS wrote:

JS

unread,
Sep 2, 2017, 8:31:30 AM9/2/17
to PPP-public
Thanks for your quick reply, I finally got it working after a couple of hours. I followed your steps on installing TDM-gcc and it works. However I was curious why the mingw-w64 build I installed wasn't working. TDM-gcc's latest version is 5.1.0 I think and mingw-w64 has a newer version. So I installed TDM together with my already installed previous compiler (i686-w64-mingw32 5.4.0). After a couple of runs I find that TDM is running fine, but mingw64 isn't. I looked into the windows user variable PATH and saw TDM was sitting underneath mingw64. I thought that maybe something is conflicting with my previous compiler - so I went into the system variables and put mingw64's bin directory to the highest slot, then after a restart I can run the above code just fine.

Note that I have no idea what mingw64 is conflicting with, and how TDM did not get affected. I am thinking it was because they package their stuff differently. I have to manually put mingw64's bin directory into system variable because putting it into user variable did not work. TDM's installer put its bin directory into the user variable.

So I concluded that mingw64 conflicted with something in my system's variable, solved it by moving the directory to the highest place. Now code runs fine.

Thanks for explaining things to me, I really appreciate it.


Reply all
Reply to author
Forward
0 new messages