Cannot compile static library of libcurl

时间:2016-03-04 17:59:19

标签: c++ curl static-libraries libcurl

I've been reading all over the internet and tried many things but still I cannot seem to find the problem. I'm trying to use libcurl as a static lib but here is what my compiler says :

1>libcurl.lib(cookie.obj) : error LNK2001: unresolved external symbol __imp__fgets 1>libcurl.lib(netrc.obj) : error LNK2001: unresolved external symbol __imp__fgets 1>libcurl.lib(cookie.obj) : error LNK2001: unresolved external symbol __imp__fputs 1>libcurl.lib(ftp.obj) : error LNK2001: unresolved external symbol __imp____stdio_common_vsscanf 1>libcurl.lib(rtsp.obj) : error LNK2001: unresolved external symbol __imp____stdio_common_vsscanf 1>libcurl.lib(socks.obj) : error LNK2001: unresolved external symbol __imp____stdio_common_vsscanf 1>libcurl.lib(http_proxy.obj) : error LNK2001: unresolved external symbol __imp____stdio_common_vsscanf

And so on..

I have added CURL_STATICLIB to preprocessor and even linked with these libraries: libcurl.lib openssl.lib, libssh2.lib, zlib.lib, wsock32.lib, wldap32.lib, ws2_32.lib but none of this worked.

I really would like to use it as a static library (without the .dll in the program folder) so I will appreciate if someone could help me!

PS. I am using VS2015

1 个答案:

答案 0 :(得分:4)

在Visual Studio命令提示符中设置RTLIBCFG = static。这将设置编译器为/ MT和/ MTd构建。这是一个显而易见的问题..希望有同样问题的人将受益于此!干杯!