curl-users
Curl undeclared first use in this function
Date: Thu, 1 Aug 2013 20:35:23 +0200
Hi all
I installed (curl-7.31.0-devel-mingw32.zip) in folder Mingw:
\bin
\include
\lib
pkg-config showing:
pkg-config libcurl --libs --cflags
@CPPFLAG_CURL_STATICLIB@ -IG:/MinGW/include -LG:/MinGW/lib -lcurl
I try compiling example with command line:
G:\MinGW\bin\mingw32-gcc.exe -IG:\MinGW\include -LG:\MinGW\lib -lcurl -lcrypto
-lidn -lrtmp -lssh2 -lz -o Curl1.exe Curl1.c
But an error showing:
Curl1.c:74: error: `curl' undeclared (first use in this function)
Curl1.c:74: error: (Each undeclared identifier is reported only once
Curl1.c:74: error: for each function it appears in.)
What could be the problem?
Thanks
Regards
The code is:
/****
#include <curl/curl.h>
#include <curl/types.h>
#include <curl/easy.h>
size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream) {
size_t written;
written = fwrite(ptr, size, nmemb, stream);
return written;
}
int main(void) {
CURL *pCurl;
CURLcode res;
FILE *fptr;
CURLcode codes;
char *url = "http://www.123.jpg";
char outfilename[256] = "C:\\123.jpg";
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
res = curl_easy_perform(curl);
pCurl = curl_easy_init();
if (pCurl) {
fptr = fopen(outfilename,"wb");
curl_easy_setopt(pCurl, CURLOPT_URL, url);
curl_easy_setopt(pCurl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(pCurl, CURLOPT_WRITEDATA, fptr);
res = curl_easy_perform(pCurl);
curl_easy_cleanup(pCurl);
fclose(fptr);
}
***/
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-08-01