cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Trouble Linking... in MinGW

From: George Ray Loveless <10308308_at_uvlink.uvsc.edu>
Date: Fri, 18 May 2007 21:57:32 -0600 (MDT)

Thanks for all the responses, ya, unfortunately I'm trying to get curl
running with on 'windows' (also using the MinGW IDE)... So ya i'm
having some troubles. I'm unsure if Im going about this in the right
way or If I'm even in the ball park of getting program running, please
let me know.

Again I'm just messing around with curl and I'm trying to build console
exe of the "simple.c" sample code provided. I'm getting 4 errors... it
looks to me like I'm having issues linking where simple.c can't see the
functions provide in the Curl libraries. I am using the curl
libraries, not the libcurl stuff.

Quickly..Here's my code and the errors:

/***********************************************************************
******
 * _ _ ____ _
 * Project ___| | | | _ \| |
 * / __| | | | |_) | |
 * | (__| |_| | _ <| |___
 * \___|\___/|_| \_\_____|
 *
 * $Id: simple.c,v 1.6 2004/08/23 14:22:52 bagder Exp $
 */

#include <stdio.h>
#include <curl/curl.h>

int main(void)
{
  CURL *curl;
  CURLcode res;

  curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "curl.haxx.se");
    res = curl_easy_perform(curl);

    /* always cleanup */
    curl_easy_cleanup(curl);
  }
  return 0;
}

Errors:

Main.cpp
Linking...
C:\myCurlProj\curlTest\Debug\Main.o(.text+0x2b): In function `main':
C:\myCurlProj\curlTest\Main.cpp:19: undefined reference to
`_imp__curl_easy_init'
C:\myCurlProj\curlTest\Debug\Main.o(.text+0x51):C:\myCurlProj\curlTest\M
ain.cpp:21: undefined reference to `_imp__curl_easy_setopt'
C:\myCurlProj\curlTest\Debug\Main.o(.text+0x5e):C:\myCurlProj\curlTest\M
ain.cpp:22: undefined reference to `_imp__curl_easy_perform'
C:\myCurlProj\curlTest\Debug\Main.o(.text+0x6e):C:\myCurlProj\curlTest\M
ain.cpp:25: undefined reference to `_imp__curl_easy_cleanup'

curlTest.exe - 4 error(s), 0 warning(s)

I've downLoaded the curl-7.16.2 zipped windows version, I believe this
is the developers version(headers files and everything). I've place
the content of the include folder within MinGW's searchable
directories, i'm unsure if i need to do anything else....eg additional
compling of some headers??or what?

thank you very much for any help, I really would like to create an app
that grab's the HTML of a paticular web site(It would help me out with
my work), but I was just trying to get this code running first. - Ray.
Received on 2007-05-19