I'm a new AWS developer so I may be doing something wrong, but I've done lots of searching and can't seem to find a solution to this problem.
I'm using VS 2017 Community Edition, Version 15.1 (26403.7) Release, trying to build just a simple AWS S3 Test program. I followed the instructions from the Developers Blog to install (using NuGet) AWSSDKCPP-S3 v1.0.20060301.128 (which installs AWSSDKCPP-Core v1.0.128.) The two packages show up in the Project Property pages under "Referenced Packages" as Linkage: Dynamic Library (DLL). My target environment is Windows x64 Debug (for now.)
The include files and paths seem to have been installed okay, and compiles complete without error. But when VS gets to the link stage, it can't seem to find the library functions. For a simple program:
int main()
{
Aws::SDKOptions options;
Aws::InitAPI(options);
std::cout << "Hello, AWS World!" << std::endl;
}
VS gives the error:
error LNK2019: unresolved external symbol "void __cdecl Aws::InitAPI(struct Aws::SDKOptions const &)" (?InitAPI@Aws@@YAXAEBUSDKOptions@1@@Z) referenced in function main
Is this behavior happening because I'm using VS 2017 and the NuGet packages are for an earlier version of VS? If so, is there a temporary alternative until the NuGet Packages are updated, i.e., specifying libraries directly in the VS Properties? Or do I have to go through the entire library build process?
(As a workaround, I tried specifying actual library names as input to the linker and that almost worked--but I'm still getting an unresolved external on Aws::Http::CONTENT_TYPE_HEADER. But that may be due to not having the correct libraries included or something.)
you are missing the USE_IMPORT_EXPORT definition. Nuget package is supposed to define this for you, but if you do it manually, you'll need to specify it.
Sent from my iPhone
On May 27, 2017, at 1:07 AM, prgtrdr notifications@github.com wrote:
I'm a new AWS developer so I may be doing something wrong, but I've done lots of searching and can't seem to find a solution to this problem.
I'm using VS 2017 Community Edition, Version 15.1 (26403.7) Release, trying to build just a simple AWS S3 Test program. I followed the instructions from the Developers Blog to install (using NuGet) AWSSDKCPP-S3 v1.0.20060301.128 (which installs AWSSDKCPP-Core v1.0.128.) The two packages show up in the Project Property pages under "Referenced Packages" as Linkage: Dynamic Library (DLL). My target environment is Windows x64 Debug (for now.)
The include files and paths seem to have been installed okay, and compiles complete without error. But when VS gets to the link stage, it can't seem to find the library functions. For a simple program:
int main()
{
Aws::SDKOptions options;
Aws::InitAPI(options);std::cout << "Hello, AWS World!" << std::endl;
}
VS gives the error:
error LNK2019: unresolved external symbol "void __cdecl Aws::InitAPI(struct Aws::SDKOptions const &)" (?InitAPI@Aws@@YAXAEBUSDKOptions@1@@Z) referenced in function mainIs this behavior happening because I'm using VS 2017 and the NuGet packages are for an earlier version of VS? If so, is there a temporary alternative until the NuGet Packages are updated, i.e., specifying libraries directly in the VS Properties? Or do I have to go through the entire library build process?
(As a workaround, I tried specifying actual library names as input to the linker and that almost worked--but I'm still getting an unresolved external on Aws::Http::CONTENT_TYPE_HEADER. But that may be due to not having the correct libraries included or something.)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
Thanks Jonathan. I have now been able to get the program to run.
I found that in addition to USE_IMPORT_EXPORT, I also needed to define USE_WINDOWS_DLL_SEMANTICS to fix the CONTENT_TYPE_HEADER error.
For future updates, I hope you can get the NuGet distributions work better.
the nuget distributions usually work. Could you send me your project before your changes so I can have a look?
Sent from my iPhone
On May 27, 2017, at 10:41 AM, prgtrdr notifications@github.com wrote:
Thanks Jonathan. I have now been able to get the program to run.
I found that in addition to USE_IMPORT_EXPORT, I also needed to define USE_WINDOWS_DLL_SEMANTICS to fix the CONTENT_TYPE_HEADER error.
For future updates, I hope you can get the NuGet distributions work better.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
I wasn't sure how to upload the whole project so I created a GitHub repo for it here.
Let me know if there are other files you need me to upload.
Thanks.
I am trying to statically link the aws sdk to my project. Do I still need to use USE_IMPORT_EXPORT variable ? I guess just switching Referenced Packages > AWSSDKCPP-* > Linkage to Static should have been enough right ?
Sorry if my description is incomplete, I am totally new to windows programming environment so still getting a hang of visual studio etc.
@bawejakunal I found that in addition to USE_IMPORT_EXPORT, I also needed to define USE_WINDOWS_DLL_SEMANTICS to fix the CONTENT_TYPE_HEADER error. That said, @JonathanHenson believes the NuGet package should install and set everything up correctly without extra work. Let us know if doing so works for you. If not, please be explicit about what you're doing and what errors you're receiving.
The errors are exactly what you mentioned in the first post of this issue. The only difference is that I am trying to statically link the awssdk to my project in which case USE_IMPORT_EXPORT and USE_WINDOWS_DLL_SEMANTICS do not help as these are meant for dynamic linking.
I am trying out the sample code from this post: https://aws.amazon.com/blogs/developer/using-cmake-exports-with-the-aws-sdk-for-c/
Understood. Unfortunately, I have not tried the static libraries. Maybe the moderator has experience with that…
From: Kunal Baweja [mailto:[email protected]]
Sent: Wednesday, June 14, 2017 2:37 PM
To: aws/aws-sdk-cpp aws-sdk-cpp@noreply.github.com
Cc: Bill Harts bill@hartsandco.com; Author author@noreply.github.com
Subject: Re: [aws/aws-sdk-cpp] Problem linking with Visual Studio 2017 (#544)
The errors are exactly what you mentioned in the first post of this issue. The only difference is that I am trying to statically link the awssdk to my project in which case USE_IMPORT_EXPORT and USE_WINDOWS_DLL_SEMANTICS do not help as these are meant for dynamic linking.
I am trying out the sample code from this post: https://aws.amazon.com/blogs/developer/using-cmake-exports-with-the-aws-sdk-for-c/
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/aws/aws-sdk-cpp/issues/544#issuecomment-308520869 , or mute the thread https://github.com/notifications/unsubscribe-auth/AAlyI4mOR0v8G9Y30GZ41WsL15c1Ux5Bks5sEChPgaJpZM4NoR4j . https://github.com/notifications/beacon/AAlyI0fNpecmbQPXYr5aH_ImMd-cA4gPks5sEChPgaJpZM4NoR4j.gif
Works absolutely fine on vs 2015, so I am using that for now. Thanks
I'm not surprised, there is probably some incompatibility with VS 2017 and the NuGet pkg.
On Thu, Jun 15, 2017 at 8:46 AM -0400, "Kunal Baweja" notifications@github.com wrote:
Works absolutely fine on vs 2015, so I am using that for now. Thanks
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
I didn't see above that you set your project to use the v140 toolchain. The Nuget packages are only distributed for the v120 and v140 toolchain. You can change this on your project/properties/general the setting "Platform Toolset". You have to specific customize your VS2017 install so that it installs the v140 toolchain.
Is this contributing to your issue?
The NuGet package should be updated for v141 which is what VS2017 is -- 140 is VS2015.
@jason4tw I agree, the Nuget package should be updated for the v141 toolchain.
Any progress?
Hi, thanks for your inquiry. We are working on the last step of this problem and should deliver it soon. I will let you know once done.
Thank you you helped me
yes, it works fine with Vs2015 and i face problems with vs2017
Guys, the nuget packages for VS2017(V141) have been updated and now accessible in Nuget package manage tools.
Most helpful comment
Hi, thanks for your inquiry. We are working on the last step of this problem and should deliver it soon. I will let you know once done.