Hi,
i'm trying to use cygcurl-2.dll, i downloaded a simple example from curl site bur i'm not able to compile it properly. the example is this:

#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;
}

the compiler recognizes the include of the header, but for all the rest i get : "undefined reference to `_curl_easy_init'" etc.

what am i doing wrong?

Which compiler are you using. I'm guessing that it's gcc with cygwin, since that's the library you mention.

What command line did you try?
It needs to be something like gcc prog.c -lcurl The part at the end is what tells the compiler that you're interested in using curl functionality.

Obviously, you need to find the correct name for your library to substitute in that command line.

Thanks for your answear.
yes, i'm using gcc g++, but i'm actually using it as a plugin for eclipse, so i compile my files with eclipse.
i tried importing the dll to my project, but like i said i get these errors.
maybe you can make something out of it:

**** 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/http-post.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.cpp:56: undefined reference to `_curl_easy_init'
/cygdrive/d/eclipse/workspace/connecit_uterasoft/Debug/../src/httpTest.cpp:61: undefined reference to `_curl_easy_setopt'
/cygdrive/d/eclipse/workspace/connecit_uterasoft/Debug/../src/httpTest.cpp:62: undefined reference to `_curl_easy_setopt'
/cygdrive/d/eclipse/workspace/connecit_uterasoft/Debug/../src/httpTest.cpp:63: undefined reference to `_curl_easy_setopt'
/cygdrive/d/eclipse/workspace/connecit_uterasoft/Debug/../src/httpTest.cpp:64: undefined reference to `_curl_easy_setopt'
/cygdrive/d/eclipse/workspace/connecit_uterasoft/Debug/../src/httpTest.cpp:65: undefined reference to `_curl_easy_setopt'
./src/httpTest.o:/cygdrive/d/eclipse/workspace/connecit_uterasoft/Debug/../src/httpTest.cpp:66: more undefined references to `_curl_easy_setopt' follow
./src/httpTest.o: In function `main':
/cygdrive/d/eclipse/workspace/connecit_uterasoft/Debug/../src/httpTest.cpp:69: undefined reference to `_curl_easy_perform'
/cygdrive/d/eclipse/workspace/connecit_uterasoft/Debug/../src/httpTest.cpp:72: 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

like i said, it recognizes the #include <curl/curl.h> but not the commands that come after.

originally i come from java world, so i'm not very familiar with c++, so i'd appriciate it if you can give it to me in laim terms :).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.