-2

I'm trying to get this sample code working, but I keep getting errors.

I'm using Qt, so I've added the curl.h file and included it, and then pasted the code as it is in the sample (except for the #include, being a different path).

But when I build I get 10 compiler errors and I don't know what they mean, stuff like:

...\main.cpp:11: error: undefined reference to `_imp__curl_easy_init'    
...\main.cpp:13: error: undefined reference to `_imp__curl_easy_setopt'

and so on.

I'm not sure if I'm using the right library/header files, I don't know what I'm doign wrong.

I downloaded curl-7.45.0.zip and included the curl.h inside "include/curl" into my project, and I can see that Qt reads it because the autocomplete works.

I'm on Windows 7 64 bit.

Solved: I had to use MinGW libraries and modify the .pro file to add -lcurl

Metsuryu
  • 35
  • 1
  • 8
  • Did you search it? http://stackoverflow.com/questions/5485081/how-do-i-solve-these-libcurl-linking-errors – Nayana Adassuriya Oct 18 '15 at 04:31
  • Sorry, I didn't know how it was called, maybe I should have searched the errors, thanks. – Metsuryu Oct 18 '15 at 04:36
  • Hey, I managed to compile it (I think), and now the errors are different. It says that it cannot find -llibcurl.dll. Any idea what I'm doing wrong? – Metsuryu Oct 18 '15 at 09:15
  • your application cant find the path to DLL. Look at this answer http://stackoverflow.com/questions/2119539/visual-studio-how-to-set-path-to-dll – Nayana Adassuriya Oct 18 '15 at 09:21
  • Should I set the environment path somewhere? But the .dll isn't in the folder anywhere, I don't think that would solve anything right? Maybe I did something wrong in the compiling? There is a libcurl-4.dll but not the llibcurl.dll that I need. Sorry for asking so many questions, but I'm really desperate. – Metsuryu Oct 18 '15 at 09:29

1 Answers1

1

You should tell the compiler where curl library is. You can use pkg-config for that, makes it a whole lot simpler.

$(pkg-config --cflags libcurl)
Behrooz
  • 1,696
  • 2
  • 32
  • 54
  • 1
    On Windows 7 64 bit, not sure this is going to help – jbm Oct 18 '15 at 04:54
  • 1
    ah. I havn't used windows for a really long time, Have no idea if pkg-config is there or not. You can just write the full path of the lib instead of that. – Behrooz Oct 18 '15 at 04:56
  • I'm no the one who asked the question. I was rather trying to tell your answer is out of topic since the OP states he uses Windows 7 64 bit (though I did not used windows for 15 years, I bet there's no pkgconfig). – jbm Oct 18 '15 at 05:01