0

I'm trying to use #include "curl.h" library (and its recognized by my compiler), but I'm reading this error:

undefined reference to '__imp_curl_global_init'
undefined reference to '__imp_curl_easy_init'
undefined reference to '__imp_curl_easy_setopt'
undefined reference to '__imp_curl_easy_easy_perform'

Among other undefined references to curl objects. I've been researching a resolution to this semi-common issue with the curl library. Almost all of them are ubuntu and command prompt related. I'm using Dev C++ IDE with Windows. I'm suspecting a linker issue. Any way to solve this?

  • Are you linking libcurl.a (static) OR libcurl.dll.a (dynamic)? Show the link command that is executed. – Jon Goodwin Nov 04 '17 at 20:40
  • linker: -static-libgcc – DragonflyBeach Nov 04 '17 at 21:31
  • Clearly -static-libgcc is not enough. Also link libcurl (-libcurl). Remember to set the linker path to this library (which you should have downloaded with the curl.h include file) so the linker can find it. – Jon Goodwin Nov 04 '17 at 22:57
  • Could you give an example of a command for the linker? Yes I have the libcurl.exp and .lib files. – DragonflyBeach Nov 05 '17 at 00:42
  • And I also already have the libcurl file paths in my C++ Includes directories – DragonflyBeach Nov 05 '17 at 00:48
  • Linker (library) paths (-L on the command line) are NOT the same as include paths (-I on the command line). I already gave you linker command: -libcurl. – Jon Goodwin Nov 05 '17 at 01:56
  • Hmm I'm getting cannot find -libcurl error Maybe I'm using the command wrong. – DragonflyBeach Nov 05 '17 at 02:17
  • I'm suspecting maybe I'm using a bad libcurl file. Should the libcurl extensions be .lib or .exp? I'm looking around and others have libcurl.dll – DragonflyBeach Nov 05 '17 at 02:24
  • So I used that command in my linker library and my compiler didnt recognize it. – DragonflyBeach Nov 06 '17 at 01:54
  • I would really like to help you out, but I see no real effort on your part yet, If your new to programming show your effort in your question (edit's at the end) I know Dev C++ IDE inside out, I would question why you are using it. New programmers are welcome on this site, but it's is not a TUTORIAL site (we don't answer homework questions etc...(pointless)), there are many. Do SOME research. – Jon Goodwin Nov 06 '17 at 19:56
  • I did some research and I actually got passed this issue. However I'm still struggling. I've been researching it for 3 weeks now. I'm not new to C++ but I am new to calling data from a url and a coherent example of how to use curl is all I'm looking for. Feel free to see my updated question. I'm trying it on code blocks now. https://stackoverflow.com/questions/47140466/cannot-find-lcurldll-error – DragonflyBeach Nov 06 '17 at 22:22
  • I"ll help u out if no one else will, I got stuff to do, but I will help eventually. I see you, I thought your lazy, and needed space to see, but WE will fix your problem (easy for me , but I guess hard 4 u, but like all problems, time fixes them ). – Jon Goodwin Nov 07 '17 at 02:23

0 Answers0