I reciently installed the cURL libraries in Dev-C++ using the Packman.exe which is included in the Dev-C++ install. When I try to use #include <curl/curl.h> I do not get an error, so I am assuming that it installed correctly. However, when I try and compile an example from the cURL website, I get the following errors:
[Linker error] undefined reference to _imp__curl_easy_init
[Linker error] undefined reference to _imp__curl_easy_setopt
[Linker error] undefined reference to _imp__curl_easy_perform
[Linker error] undefined reference to _imp__curl_easy_cleanup
The source code I am using is as follows:
#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://example.com");
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
return 0;
}
Thank you! 🙂
There are a couple of ways you can add the .lib and/or .a files to the linker in Dev-C++:
The following is what I did when completing the boost tutorial http://www.boost.org/doc/libs/1_46_1/more/getting_started/windows.html#link-your-program-to-a-boost-library :
or
Project > Project Options > Parameters > Linker
I haven’t used libcurl but hopefully the process is similar.