The question seems straight forward. I tried a lot of things just to include curl in my C project using the code::blocks ide but to no avail.
I would like to use cURL's library for my console app project that needs http capabilities.
If anyone had successfully done so, then your help is very much appreciated. :)
What happened previously:
-I copied all cURL files to my project and linked the libraries (the ones with .a or .lib ext.)
-Then when I build the project. A lot of undefined reference showed up.
This is the code I was testing:
#include <stdio.h>
#include <stdlib.h>
#include <curl/curl.h>
int main()
{
curl_global_init( CURL_GLOBAL_ALL );
CURL * myHandle;
CURLcode result;
myHandle = curl_easy_init ( ) ;
curl_easy_setopt(myHandle, CURLOPT_URL, "http://www.example.com");
result = curl_easy_perform( myHandle );
curl_easy_cleanup( myHandle );
printf("LibCurl rules!
");
return 0;
}
Here are the errors:
||=== Fa, Release ===|
objReleasemain.o:main.c|| undefined reference to `_imp__curl_global_init'|
objReleasemain.o:main.c|| undefined reference to `_imp__curl_easy_init'|
objReleasemain.o:main.c|| undefined reference to `_imp__curl_easy_setopt'|
objReleasemain.o:main.c|| undefined reference to `_imp__curl_easy_perform'|
objReleasemain.o:main.c|| undefined reference to `_imp__curl_easy_cleanup'|
||=== Build finished: 5 errors, 0 warnings ===|
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…