Libcurl compiling error: "undefined reference to `__mingw_basename'"

1.3k Views Asked by At

This question has already been asked, but no answers. I am trying to link statically libcurl on Windows with GNU GCC compiler (using last curl version 7.51) I have added ws2_32.a and libcurl.a to the linked libraries with the option -static and in search directories I have included curl\include and the /lib. And I added CURL_STATICLIB in defines.

Build Log:

mingw32-g++.exe -Wall -fexceptions -g -std=c++11 -DCURL_STATICLIB -IC:\Libcurl\static_built\include -IC:\c++\Tutorials\.cbp\libCurl -c C:\c++\Tutorials\.cbp\libCurl\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -LC:\Libcurl\static_built\lib -o bin\Debug\libCurl\.exe.exe obj\Debug\main.o  -static  C:\Libcurl\static_built\lib\libcurl.a C:\MinGW\lib\libws2_32.a
C:\Libcurl\static_built\lib\libcurl.a(libcurl_la-formdata.o):formdata.c:(.text+0x491): undefined reference to `__mingw_basename'
collect2.exe: error: ld returned 1 exit status

Particularly the error:

undefined reference to `__mingw_basename'
1

There are 1 best solutions below

0
On BEST ANSWER

You need to link libmingwex.a in order to solve the problem: undefined reference to __mingw_basename'. This library is located at MinGW/libs.