Aws-sdk-cpp: vcpkg with x64-windows-static

Created on 22 Feb 2019  路  7Comments  路  Source: aws/aws-sdk-cpp

I鈥檓 trying to use vcpkg and build the sdk as static. Vcpkg returns with no errors but when I go to build my project in visual studio I get linker errors. My vcpkg command is

vcpkg install aws-sdk-cpp[core,polly,text-to-service]:x64-windows-static

The error is LNK2001 and it comes from core.

guidance

All 7 comments

Hi @hansob3, have you looked at the vcpkg docs[1] for MSBuild integration and how to select your triplet?

You will need to add an MSBuild property to indicate that you want to use static binaries.

[1] https://github.com/Microsoft/vcpkg/blob/master/docs/users/integration.md#triplet-selection

I did see that and copied that into my .vcxproj just as they have it.

Could you please post a short source snippet that causes the problem and also post the linker error in full?

Here is the output from the build. For a code snippet I am just using the polly example as is. I created a new console project then just copied the code in from main. In the project settings I changed to /MT

1>aws-cpp-sdk-core.lib(Net.cpp.obj) : error LNK2001: unresolved external symbol __imp_WSAStartup 1>aws-cpp-sdk-core.lib(Net.cpp.obj) : error LNK2001: unresolved external symbol __imp_WSACleanup 1>aws-cpp-sdk-core.lib(FileSystem.cpp.obj) : error LNK2001: unresolved external symbol __imp_GetUserProfileDirectoryW 1>aws-cpp-sdk-core.lib(OSVersionInfo.cpp.obj) : error LNK2001: unresolved external symbol GetFileVersionInfoSizeA 1>aws-cpp-sdk-core.lib(OSVersionInfo.cpp.obj) : error LNK2001: unresolved external symbol GetFileVersionInfoA 1>aws-cpp-sdk-core.lib(OSVersionInfo.cpp.obj) : error LNK2001: unresolved external symbol VerQueryValueA 1>aws-cpp-sdk-core.lib(SimpleUDP.cpp.obj) : error LNK2001: unresolved external symbol __imp_bind 1>aws-cpp-sdk-core.lib(SimpleUDP.cpp.obj) : error LNK2001: unresolved external symbol __imp_closesocket 1>aws-cpp-sdk-core.lib(SimpleUDP.cpp.obj) : error LNK2001: unresolved external symbol __imp_connect 1>aws-cpp-sdk-core.lib(SimpleUDP.cpp.obj) : error LNK2001: unresolved external symbol __imp_ioctlsocket 1>aws-cpp-sdk-core.lib(SimpleUDP.cpp.obj) : error LNK2001: unresolved external symbol __imp_htons 1>aws-cpp-sdk-core.lib(SimpleUDP.cpp.obj) : error LNK2001: unresolved external symbol __imp_recv 1>aws-cpp-sdk-core.lib(SimpleUDP.cpp.obj) : error LNK2001: unresolved external symbol __imp_recvfrom 1>aws-cpp-sdk-core.lib(SimpleUDP.cpp.obj) : error LNK2001: unresolved external symbol __imp_send 1>aws-cpp-sdk-core.lib(SimpleUDP.cpp.obj) : error LNK2001: unresolved external symbol __imp_sendto 1>aws-cpp-sdk-core.lib(SimpleUDP.cpp.obj) : error LNK2001: unresolved external symbol __imp_setsockopt 1>aws-cpp-sdk-core.lib(SimpleUDP.cpp.obj) : error LNK2001: unresolved external symbol __imp_socket 1>aws-cpp-sdk-core.lib(SimpleUDP.cpp.obj) : error LNK2001: unresolved external symbol __imp_WSAGetLastError 1>aws-cpp-sdk-core.lib(SimpleUDP.cpp.obj) : error LNK2001: unresolved external symbol __imp_inet_pton 1>aws-cpp-sdk-core.lib(CryptoImpl.cpp.obj) : error LNK2001: unresolved external symbol BCryptOpenAlgorithmProvider 1>aws-cpp-sdk-core.lib(CryptoImpl.cpp.obj) : error LNK2001: unresolved external symbol BCryptGetProperty 1>aws-cpp-sdk-core.lib(CryptoImpl.cpp.obj) : error LNK2001: unresolved external symbol BCryptSetProperty 1>aws-cpp-sdk-core.lib(CryptoImpl.cpp.obj) : error LNK2001: unresolved external symbol BCryptCloseAlgorithmProvider 1>aws-cpp-sdk-core.lib(CryptoImpl.cpp.obj) : error LNK2001: unresolved external symbol BCryptEncrypt 1>aws-cpp-sdk-core.lib(CryptoImpl.cpp.obj) : error LNK2001: unresolved external symbol BCryptDecrypt 1>aws-cpp-sdk-core.lib(CryptoImpl.cpp.obj) : error LNK2001: unresolved external symbol BCryptExportKey 1>aws-cpp-sdk-core.lib(CryptoImpl.cpp.obj) : error LNK2001: unresolved external symbol BCryptImportKey 1>aws-cpp-sdk-core.lib(CryptoImpl.cpp.obj) : error LNK2001: unresolved external symbol BCryptDestroyKey 1>aws-cpp-sdk-core.lib(CryptoImpl.cpp.obj) : error LNK2001: unresolved external symbol BCryptCreateHash 1>aws-cpp-sdk-core.lib(CryptoImpl.cpp.obj) : error LNK2001: unresolved external symbol BCryptHashData 1>aws-cpp-sdk-core.lib(CryptoImpl.cpp.obj) : error LNK2001: unresolved external symbol BCryptFinishHash 1>aws-cpp-sdk-core.lib(CryptoImpl.cpp.obj) : error LNK2001: unresolved external symbol BCryptDestroyHash 1>aws-cpp-sdk-core.lib(CryptoImpl.cpp.obj) : error LNK2001: unresolved external symbol BCryptGenRandom 1>aws-cpp-sdk-core.lib(WinINetSyncHttpClient.cpp.obj) : error LNK2001: unresolved external symbol __imp_InternetOpenA 1>aws-cpp-sdk-core.lib(WinINetSyncHttpClient.cpp.obj) : error LNK2001: unresolved external symbol __imp_InternetCloseHandle 1>aws-cpp-sdk-core.lib(WinINetConnectionPoolMgr.cpp.obj) : error LNK2001: unresolved external symbol __imp_InternetCloseHandle 1>aws-cpp-sdk-core.lib(WinINetSyncHttpClient.cpp.obj) : error LNK2001: unresolved external symbol __imp_InternetReadFile 1>aws-cpp-sdk-core.lib(WinINetSyncHttpClient.cpp.obj) : error LNK2001: unresolved external symbol __imp_InternetWriteFile 1>aws-cpp-sdk-core.lib(WinINetSyncHttpClient.cpp.obj) : error LNK2001: unresolved external symbol __imp_InternetSetOptionA 1>aws-cpp-sdk-core.lib(WinINetConnectionPoolMgr.cpp.obj) : error LNK2001: unresolved external symbol __imp_InternetSetOptionA 1>aws-cpp-sdk-core.lib(WinINetSyncHttpClient.cpp.obj) : error LNK2001: unresolved external symbol __imp_HttpOpenRequestA 1>aws-cpp-sdk-core.lib(WinINetSyncHttpClient.cpp.obj) : error LNK2001: unresolved external symbol __imp_HttpAddRequestHeadersA 1>aws-cpp-sdk-core.lib(WinINetSyncHttpClient.cpp.obj) : error LNK2001: unresolved external symbol __imp_HttpSendRequestExA 1>aws-cpp-sdk-core.lib(WinINetSyncHttpClient.cpp.obj) : error LNK2001: unresolved external symbol __imp_HttpEndRequestA 1>aws-cpp-sdk-core.lib(WinINetSyncHttpClient.cpp.obj) : error LNK2001: unresolved external symbol __imp_HttpQueryInfoA 1>aws-cpp-sdk-core.lib(WinINetConnectionPoolMgr.cpp.obj) : error LNK2001: unresolved external symbol __imp_InternetConnectA

I added those but I am still left with these:
1>aws-cpp-sdk-core.lib(OSVersionInfo.cpp.obj) : error LNK2001: unresolved external symbol GetFileVersionInfoSizeA
1>aws-cpp-sdk-core.lib(OSVersionInfo.cpp.obj) : error LNK2001: unresolved external symbol GetFileVersionInfoA
1>aws-cpp-sdk-core.lib(OSVersionInfo.cpp.obj) : error LNK2001: unresolved external symbol VerQueryValueA

I went to the Microsoft Docs and tried adding Mincore.lib as well but I am still getting these errors.

Also found that I needed to add version.lib. Once that was added the build succeeded. I read about it here.

Was this page helpful?
0 / 5 - 0 ratings