curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Undefined Reference Error when Linking .OBJ file

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Thu, 4 Apr 2019 23:47:18 +0200 (CEST)

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-04