How to circumvent curl/curlbuild.h error?
I would like to write a program that takes files from the website as
input. Searching the internet on how best to do this, I stumbled across
"cURL and libcurl" library and decided to go through its tutorial to get a
feel for it. I am using Visual Studio and found this link
http://quantcorner.wordpress.com/2012/04/08/using-libcurl-with-visual-c-2010/
that explains how to install cURL with Visual Studio. I followed the
instructions there except for the last line that says:
Now, open the curl.h file. Replace the line #include "curl/curlbuild.h"
with #include "curlbuild.h" .
I couldn't make this change since the code for the tutorial file that I
wanted to run in VS doesn't contain curl/curlbuild.h, I also had to
comment out #include <curl/curl.h> and replace it with #include <curl.h>
in order for VS to accept my code. But when I tried to run the program
#include <stdio.h>
//#include <curl/curl.h>
#include <curl.h>
#include "curlbuild.h"
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
/* example.com is redirected, so we tell libcurl to follow redirection */
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}
I got this error:
1>------ Build started: Project: cURL.c, Configuration: Debug Win32 ------
1> main.c 1>c:\libcurl\include\curl\curl.h(35): fatal error C1083: Cannot
open include file: 'curl/curlbuild.h': No such file or directory
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========
So the compiler is complaining about the same error that was mentioned in
the above installation guide. What can I do to circumvent this error?
No comments:
Post a Comment