Can someone help me with the CURL library using GCC on Cygwin?
I can't find anything in the documents that explain exactly how to compile with g++.
g++ -I curl CurlSample.cpp
gives me errors such as:
/tmp/ccrXZUYr.o:CurlSample.cpp:(.text+0x17): undefined reference to `_curl_easy_
I'm using gcc version 4.3.4 ... all of the curl files are installed in the directory /usr/include/curl
Any help would be much appreciated... thanks!
2 Years Ago
Related Article:Downloading URL with C++ (Windows)
is a solved C++ discussion thread by JeremyJ that has 2 replies, was last updated 2 years ago and has been tagged with the keywords: c++, curl, cygwin, download, file, url.
Thanks for the link, but I'm still not able to compile correctly.
I found libcurl.a, copied that to my directory, now what?
When I try to compile I still get error messages. Any suggestions?
$ cc -o CurlSample.exe CurlSample.cpp -L/libcurl.a
/tmp/ccjGDNTk.o:CurlSample.cpp:(.text+0x17): undefined reference to `_curl_easy_init'
/tmp/ccjGDNTk.o:CurlSample.cpp:(.text+0x3b): undefined reference to `_curl_easy_setopt'
/tmp/ccjGDNTk.o:CurlSample.cpp:(.text+0x46): undefined reference to `_curl_easy_perform'
/tmp/ccjGDNTk.o:CurlSample.cpp:(.text+0x54): undefined reference to `_curl_easy_cleanup'
/tmp/ccjGDNTk.o:CurlSample.cpp:(.eh_frame+0x11): undefined reference to `___gxx_personality_v0'
collect2: ld returned 1 exit status
There should be a file called libcurl.so and/or a file called libcurl.a in the /usr/lib directory. You need to link one of them. I use the .so file, but I imagine it doesn't matter.
Here's a decent tutorial on linking shared objects.