问题
I'm trying to link aws-sdk-ec2 to my application,but I'm a getting a linker error from Visual Studio 2013.I have compiled the SDK successfully and linked aws-sdk-core.lib and aws-sdk-ec2.lib on my project settings.
The error I'm getting is:
Error 1 error LNK2001: unresolved external symbol "char const * const Aws::Http::CONTENT_TYPE_HEADER" (?CONTENT_TYPE_HEADER@Http@Aws@@3PBDB) E:\Users\..\..\..\main.obj
Any ideas what is the problem ? Do I need to link any aws-sdk-* component ?
回答1:
I have solved the issue by added
USE_IMPORT_EXPORT
to my preprocessor definitions, project->properties->c/c++ ->preprocessor
回答2:
Yes, the output from the visual-c++ linker is really cryptic on this one. The dll import stuff hasn't been declared when you compiled your code. What the error is really saying is that the linker can't find ANY of the symbols. Try adding USE_IMPORT_EXPORT to your compiler flags.
Also are you using the NuGet package or compiling from source?
回答3:
I was able to get it working by:
#define USE_IMPORT_EXPORT
in my codeProject Configuration Properties(*) -> C/C++ -> Code Generation -> Runtime Library set to Multi-threaded Debug DLL (/MDd) instead of linking statically
* - Right click on the project in Solution Explorer and Properties
来源:https://stackoverflow.com/questions/37411546/aws-c-sdk-linker-error-on-visual-studio