简体   繁体   中英

Linker is unable to locate curl_global_init

I am compiling a C++ application on Ubuntu 18.04. The linker is unable to pickup the required functions from the library or it is not locating the right library

I have libcurl.so located at /usr/local/lib

nm -D lists all the functions I need with T prefix . Yet when I compile as follows

g++ -std=c++17  -lcurl  tz.o main.o

I get

/usr/bin/ld: tz.o: in function 'date::curl_global()':
tz.cpp:(.text+0x9aef): undefined reference to 'curl_global_init'

I tried installing openssl-dev . No joy. So I uninstalled it.

try

g++ -std=c++17 tz.o main.o -lcurl

instead... g++ is shit in some ways, like argument ordering. (all i did was to make -lcurl the last argument instead of argument #3)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM