AWS C++ SDK linker error on visual studio

蹲街弑〆低调 提交于 2021-01-27 12:20:49

问题


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 code

  • Project 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!