0

System Windows 7 64bit, Eclipse Mars + CDT, MinGW 64, curl source https://curl.haxx.se/download.html for Win64 - MinGW64 SSH SSL, have tried other versions with very same linker errors Code:

#include <curl/curl.h>
int main(void) {
    CURL * curl;
    curl = curl_easy_init();
    if (curl) {
        curl_easy_cleanup(curl);
    }
    return 0;
}

The problem with linker errors:

Info: Internal Builder is used for build
g++ -DCURL_STATICLIB "-IC:\\Source\\curl-7.40.0-devel-mingw64\\include" "-IC:\\Source\\curl-7.40.0-devel-mingw64\\include\\curl" -O0 -g3 -Wall -c -fmessage-length=0 -o main.o "..\\main.cpp" 
g++ -static -Wl,-Map,output.map -o xmlServiceCall.exe main.o -lcurl "-LC:\\Source\\curl-7.40.0-devel-mingw64\\lib64" 
main.o: In function `main':
C:\workspace_mars_cpp\xmlServiceCall\Debug/../main.cpp:8: undefined reference to `curl_easy_init'
C:\workspace_mars_cpp\xmlServiceCall\Debug/../main.cpp:25: undefined reference to `curl_easy_cleanup'
collect2.exe: error: ld returned 1 exit status

14:14:56 Build Finished (took 848ms)

Have read dozens of similar questions here, and also on other internets, but they all suggest change linking order or add paths which doesn't help. Where else could I dig to solve this problem?

WhiteTiger
  • 31
  • 3
  • How did you build `libcurl.a`? – πάντα ῥεῖ Jun 07 '16 at 11:38
  • I didnt build, it was ready-to-use from download site, it says: all libs of this package are build with MinGW64 compiler – WhiteTiger Jun 07 '16 at 11:43
  • Can you check which symbols you `libcurl.a` exports? Run `nm libcurl.a` and check if `curl_easy_init` and `curl_easy_cleanup` are on the list – Smeeheey Jun 07 '16 at 12:03
  • Hmm.. it only says "File format not recognized" on ~30ish *.o files, does it mean the library file could be corrupted? – WhiteTiger Jun 07 '16 at 12:17
  • These days the file format could be a 64 vs. 32 bit problem. That gets ironed out eventually, I remember 32 vs 16. – Alan Corey May 16 '18 at 00:20
  • Does this answer your question? [undefined reference to curl\_global\_init, curl\_easy\_init and other function(C)](https://stackoverflow.com/questions/16476196/undefined-reference-to-curl-global-init-curl-easy-init-and-other-functionc) – Johnny May 27 '21 at 01:03

0 Answers0