curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Undefined Reference Error when Linking .OBJ file

From: Dan Gribble via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 9 Apr 2019 12:20:44 +0000

Thanks for the response Daniel. I can compile and link using the -I and -lcurl parameters when using gcc within CYGWIN, hoever, I have a specific requirement at my place of work which means I must use WATCOM to compile and link.

I appreciate this may not be your area of expertise but I can compile my test.cpp program fine when supplying the path to the various cURL header files, however, the problem comes at the linking stage. The -lcurl parameter is not supported by WATCOM.

WATCOM has a few LIB/LIBPath commands, but I can't find any other .lib files in the package I downloaded from the cURL website.

I have a libcurl.a and a libcurl.dll.a file in my Windows 7 cURL /lib folder, but that it is it.

Do I need to download anything else (.lib, .dll etc) which I need to refer to when linking?

Thanks
Dan Gribble
________________________________
From: Daniel Stenberg <daniel_at_haxx.se>
Sent: 04 April 2019 22:47
To: Dan Gribble via curl-library
Cc: Dan Gribble
Subject: Re: Undefined Reference Error when Linking .OBJ file

On Thu, 4 Apr 2019, Dan Gribble via curl-library wrote:

> Using the cURL commandline application I can get the desired JSON hello
> world response, however, when attempting to link after compiling (using open
> Watcom 1.9) a simple test.cpp file on Windows 7, I get the following errors:
>
> Error! E2028: curl_slist_append_ is an undefined reference
> Error! E2028: curl_easy_init_ is an undefined reference
> Error! E2028: curl_easy_setopt_ is an undefined reference

These are all symbols present in and provided by libcurl.

> Using the -DWIN32 and -DCURL_STATICLIB on my compile command prior to
> linking doesn't seem to make any difference.

-D is an option that sets defines, they're used by the preprocessor which is
the state before compiling. After the compiling comes the linking stage for
which you need to tell it to use libcurl.

> I understand you may think this is more of a compile/link problem rather
> than a specific cURL problem, but I would be grateful if anyone could offer
> any advice or point me in the right direction of where I can find the
> answer. Am I missing any specific files or libraries that need to be
> included when compiling or linking?

I don't know the exactly format for your build/compiler but on most systems
you use -lcurl to tell it to link with libcurl, and then -L[dir] to tell it to
look in [dir] for libs it can't find in the default locations.

--
  / daniel.haxx.se

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-04-09