Eclipse - How include Curl libraries

Aug 31, 2011 at 7:51pm
I have curl installed in my linux Ubuntu. I tested it from terminal and it is ok. Now I want to include in my Eclipse project. I just wrote /usr/local/curl-7.21.7/lib in GCC C++ Linker under Library Search Path (-L). What else should I do? I am getting the message "undefined reference to `curl_easy_init'" to teste the below code.

#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://www.google.com");
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}
Aug 31, 2011 at 8:22pm
-lcurl or something like that under linker settings.
To be sure, do
ls /usr/local/curl-7.21.7/lib/*.a
If the result is libfoo.a, the option is -lfoo
Last edited on Aug 31, 2011 at 8:24pm
Sep 1, 2011 at 12:03pm
Helios, first of all, thanks for your answer. I don't have any file with .a extension. I have these files beginning with lib*.* : libcurl.imp libcurl.la libcurl.plist libcurl.rc libcurl.vcproj. Do you have some idea what is wrong?
Sep 1, 2011 at 2:51pm
Then you don't have a correct libcurl installation. The *.imp, *.rc, and *.vcproj are Windows files.
Topic archived. No new replies allowed.