Hi,
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++.
For instance:
g++ -I curl CurlSample.cpp

gives me errors such as:
/tmp/ccrXZUYr.o:CurlSample.cpp:(.text+0x17): undefined reference to `_curl_easy_
init'

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!

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
Jeremy@jj-laptop /cygdrive/c/cygwin/home/Jeremy/project

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.

http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html

This article has been dead for over six months. Start a new discussion instead.