Click here to Skip to main content
16,013,489 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
C++
#include 
#include 
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;
}
Posted
Updated 31-Aug-11 18:06pm
v2
Comments
Prerak Patel 1-Sep-11 0:06am    
Use code block for code segments in question.

1 solution

You should add the -lcurl option to your linker settings.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900