3

I was doing a project in which i needed to make HTTP request to access webpages,make downloads etc.. So i decided to use Curl.

I downloaded curl-7.39.0-devel-mingw64.7z and extracted it and added the libraries, bin, and includes to mingw.

I am using Netbeans IDE. So i added -lcurl in project properties->linkers->additional options

but now i get the following errors.

g++ -o dist/Debug/MinGW-Windows/app build/Debug/MinGW-Windows/mainConnector.o -lcurl build/Debug/MinGW-Windows/mainConnector.o: In function `Z9connectorv':

C:\Users\0xuser\Documents\NetBeansProjects\app/mainConnector.cpp:8: undefined reference to `_imp__curl_global_init'

.

.(some more similar errors)

.

collect2.exe: error: ld returned 1 exit status

I linked the library correctly right. Then why is this showing up?

Note: I Googled about this and found about linking curl library by adding -lcurl but its not working for me. On my research i understood linking is a common problem for a newbie and even on stackoverflow.com we have similar questions(Oh yeah i readed these https://stackoverflow.com/questions/7604889/mingw32-curl-on-windows-7-error-undefined-reference-to-imp-curl-global-init ). But they only answer upto adding the -lcurl. They don't say about the possibilities for that to fail as in my case.

Community
  • 1
  • 1
Cijo
  • 2,726
  • 1
  • 14
  • 24
  • 1
    Instead, build it yourself: http://stackoverflow.com/a/27609214/1462718 – Brandon Dec 23 '14 at 15:57
  • @bardon I did what u said using MYSYS with mingw but still got the same error. – Cijo Dec 23 '14 at 18:51
  • 2
    add `-DCURL_STATICLIB` then try building your project. – Brandon Dec 23 '14 at 20:10
  • @Brandon I was able to do the compiling when i set the configuration as static instead of application and adding -DCURL_STATICLIB. But that wont produce the executable. In order to do just that i need to compile it in application mode and in application mode it just didn't works. Give me the same error... – Cijo Dec 24 '14 at 03:10

0 Answers0