cURL / Mailing Lists / curl-library / Single Mail

curl-library

Problems in trying to compile htmltidy example in libcurl

From: ying lcs <yinglcs_at_gmail.com>
Date: Thu, 12 Jul 2007 12:00:13 -0500

Hi,
I am trying to compile the htmltidy example in libcurl, but taking
away the tidy part:

here is my code:
* curl write callback, to fill tidy's input buffer... */
uint write_cb(char *in, uint size, uint nmemb, void *out)
{
  uint r;
  r = size * nmemb;
  return(r);
}

int main(int argc, char **argv )
{
  CURL *curl;
  char curl_errbuf[CURL_ERROR_SIZE];
  char docbuf[1024];

  int err;
  if ( argc == 2) {
    curl = curl_easy_init();
    curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
    curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_errbuf);
    curl_easy_setopt(curl, CURLOPT_NOPROGRESS, no);
    curl_easy_setopt(curl, CURLOPT_VERBOSE, yes);
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, &docbuf);
    err=curl_easy_perform(curl);

    /* clean-up */
    curl_easy_cleanup(curl);

    return(err);
  }
  else
    printf( "usage: %s <url>\n", argv[0] );

  return(0);
}

And here is my compile error:

**** Build of configuration Debug for project testCURL ****

make all
Building file: ../test.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"test.d"
-MT"test.d" -o"test.o" "../test.cpp"
../test.cpp: In function 'int main(int, char**)':
../test.cpp:25: error: 'no' was not declared in this scope
../test.cpp:26: error: 'yes' was not declared in this scope
make: *** [test.o] Error 1

Can you please tell me how to fix my compile problems?

Thank you.
Received on 2007-07-12