>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

The symbols come from curl. Something is wrong with your build command.

>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<ftp://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

These unresolved symbols all from dependent (Windows) libraries of curl. You 
have to add them on your command line for the linker command. Some are already 
included (like kernel32.lib), but e.g. WSAStartup (see 
https://docs.microsoft.com/en-us/windows/desktop/api/winsock/nf-winsock-wsastartup)
 comes from ws2_32.lib. If you add that library in your build command line, 
this error will disappear. The automatic include of windows system libraries 
was removed by a pull request of me (see 
https://github.com/curl/curl/pull/2474). You have to add yourself windows 
system libraries that are needed by curl (depending on how you have configured 
curl, e.g. with or without openSSL etc).


-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to