Hi, I'm trying to build an x64 static library of libcurl to use in a project for Windows. I downloaded the latest version (7.61.0) and ran the following command without getting any errors:
nmake /f Makefile.vc mode=static VC=15 MACHINE=x64 RTLIBCFG=static Now, in a Visual Studio (2017) project, I use a simple example from libcurl to test if everything is working. The source code is located here: https://curl.haxx.se/libcurl/c/simple.html I add the include and lib directories to the project properties and add the .lib file as an input to the linker. I also use the "multi-threaded" option for the runtime library since I used "RTLIBCFG=static" for the build command. I get the following errors when I try to build the project: 1>project.obj : error LNK2001: unresolved external symbol __imp_curl_easy_init 1> project.obj : error LNK2001: unresolved external symbol __imp_curl_easy_setopt 1> project.obj : error LNK2001: unresolved external symbol __imp_curl_easy_perform 1> project.obj : error LNK2001: unresolved external symbol __imp_curl_easy_strerror 1> project.obj : error LNK2001: unresolved external symbol __imp_curl_easy_cleanup 1>C:\Users\user\source\repos\project\x64\Release\project.exe : fatal error LNK1120: 5 unresolved externals After some Googling, it looked like I may need to add CURL_STATICLIB to my preprocessor definitions in the project properties. I do so and I get the following errors: 1>libcurl_a.lib(easy.obj) : error LNK2001: unresolved external symbol __imp_WSAStartup 1>libcurl_a.lib(telnet.obj) : error LNK2001: unresolved external symbol __imp_WSAStartup 1>libcurl_a.lib(easy.obj) : error LNK2001: unresolved external symbol __imp_WSACleanup ... 1>libcurl_a.lib(connect.obj) : error LNK2001: unresolved external symbol __imp_connect 1>libcurl_a.lib(connect.obj) : error LNK2001: unresolved external symbol __imp_getpeername 1>libcurl_a.lib(connect.obj) : error LNK2001: unresolved external symbol __imp_getsockname 1>libcurl_a.lib(ftp.obj) : error LNK2001: unresolved external symbol __imp_getsockname ... 1>libcurl_a.lib(curl_gethostname.obj) : error LNK2001: unresolved external symbol __imp_gethostname 1>libcurl_a.lib(krb5_sspi.obj) : error LNK2001: unresolved external symbol __imp_htonl 1>libcurl_a.lib(krb5_sspi.obj) : error LNK2001: unresolved external symbol __imp_ntohl 1>C:\Users\user\source\repos\project\x64\Release\project.exe : fatal error LNK1120: 60 unresolved externals Could someone please let me know where I have messed up or what I am doing wrong? I have included the full command line flags, with "CURL_STATICLIB" defined. Thank you. Compiler flags: /permissive- /Yu"stdafx.h" /GS /GL /W3 /Gy /Zc:wchar_t /I"C:\Program Files (x86)\Curl\x64\libcurl-vc15-x64-release-static-ipv6-sspi-winssl\include" /Zi /Gm- /O2 /sdl /Fd"x64\Release\vc141.pdb" /Zc:inline /fp:precise /D "CURL_STATICLIB" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /Gd /Oi /MT /FC /Fa"x64\Release\" /EHsc /nologo /Fo"x64\Release\" /Fp"x64\Release\project.pch" /diagnostics:classic Linker flags: /OUT:"C:\Users\user\source\repos\project\x64\Release\project.exe" /MANIFEST /LTCG:incremental /NXCOMPAT /PDB:"C:\Users\user\source\repos\project \x64\Release\project.pdb" /DYNAMICBASE "libcurl_a.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG /MACHINE:X64 /OPT:REF /INCREMENTAL:NO /PGD:"C:\Users\user\source\repos\project\x64\Release\project.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\Release\project.exe.intermediate.manifest" /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:"C:\Program Files (x86)\Curl\x64\libcurl-vc15-x64-release-static-ipv6-sspi-winssl\lib" /TLBID:1
------------------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html
