cURL / Mailing Lists / curl-library / Single Mail

curl-library

a question about libcurl.dll

From: Tomer Fishaimer <tomerf_at_advantech.co.il>
Date: Tue, 17 Jul 2007 10:54:42 +0300

Hi,

I'm a java programmer, but now I received a c++ project. I need to use
the libcurl HTTP abilities.

I'm using a cygwin plugin on the eclipse (a g++ compiler) and I tried to
add the libcurl.dll to my project.

I tried running a little example from the curl package I downloaded but
I keep getting errors.

The example is :

 

/***********************************************************************
******

 * _ _ ____ _

 * Project ___| | | | _ \| |

 * / __| | | | |_) | |

 * | (__| |_| | _ <| |___

 * \___|\___/|_| \_\_____|

 *

 * $Id: http-post.c,v 1.2 2004/11/22 14:41:36 bagder Exp $

 */

 

#include <stdio.h>

#include <curl/curl.h>

 

int main(void)

{

  CURL *curl;

  CURLcode res;

 

  curl = curl_easy_init();

  if(curl) {

    /* First set the URL that is about to receive our POST. This URL can

       just as well be a https:// URL if that is what should receive the

       data. */

    curl_easy_setopt(curl, CURLOPT_URL,
"http://postit.example.com/moo.cgi");

    /* Now specify the POST data */

    curl_easy_setopt(curl, CURLOPT_POSTFIELDS,
"name=daniel&project=curl");

 

    /* Perform the request, res will get the return code */

    res = curl_easy_perform(curl);

 

    /* always cleanup */

    curl_easy_cleanup(curl);

  }

  return 0;

}

 

And the error is :

 

 

**** Build of configuration Debug for project connecit_uterasoft ****

 

make -k all

Building target: connecit_uterasoft.exe

Invoking: GCC C++ Linker

g++ -o"connecit_uterasoft.exe" ./src/ApplicationInfo.o ./src/CPUInfo.o
./src/ConnectionPoolInfo.o ./src/EJBPoolInfo.o ./src/JVMInfo.o
./src/httpTest.o ./src/testXML.o ./src/xmlParser.o
./src/objects/ApplicationObject.o ./src/objects/CPUObject.o
./src/objects/ConnectionPoolObject.o ./src/objects/EJBPoolObject.o
./src/objects/JVMObject.o ./src/objects/ServerData.o
./src/fileHandler/PropFileHandler.o ./src/constants/Constants.o

./src/httpTest.o: In function `main':

/cygdrive/d/eclipse/workspace/connecit_uterasoft/Debug/../src/httpTest.c
pp:19: undefined reference to `_curl_easy_init'

/cygdrive/d/eclipse/workspace/connecit_uterasoft/Debug/../src/httpTest.c
pp:24: undefined reference to `_curl_easy_setopt'

/cygdrive/d/eclipse/workspace/connecit_uterasoft/Debug/../src/httpTest.c
pp:26: undefined reference to `_curl_easy_setopt'

/cygdrive/d/eclipse/workspace/connecit_uterasoft/Debug/../src/httpTest.c
pp:29: undefined reference to `_curl_easy_perform'

/cygdrive/d/eclipse/workspace/connecit_uterasoft/Debug/../src/httpTest.c
pp:32: undefined reference to `_curl_easy_cleanup'

collect2: ld returned 1 exit status

make: *** [connecit_uterasoft.exe] Error 1

make: Target `all' not remade because of errors.

Build complete for project connecit_uterasoft

 

Can you please tell me what am I doing wrong?

 

P.S

I tried adding the easy.c file and it solved this problem, but then it
didn't recognize all the include in the easy.c file :-(

 

Thanks.

 

Tomer Fishaimer

J2EE Developer

Advantech Technologies Ltd.

Email: tomerf_at_advantech.co.il

 
Received on 2007-07-17