简体   繁体   English

链接器无法找到curl_global_init

[英]Linker is unable to locate curl_global_init

I am compiling a C++ application on Ubuntu 18.04. 我正在Ubuntu 18.04上编译C ++应用程序。 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 我有libcurl.so位于/usr/local/lib

nm -D lists all the functions I need with T prefix . nm -D使用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 . 我尝试安装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. 而是... g ++在某些方面很糟糕,例如参数排序。 (all i did was to make -lcurl the last argument instead of argument #3) (我所做的只是使-lcurl作为最后一个参数而不是参数#3)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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