-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LNK 2001 Errors: vcpkg with Static Libraries #2757
Comments
Hi @jasonabuzzell, I'm not an expert on using vcpkg and I'm not sure if you are able to use vcpkg with this sdk and static libraries. As noted in our readme I would recommend opening and issue on the vcpkg repository
I can help you build and use this sdk statically from the source on windows. You can do that by following the readme Building From Source. The only change you need to make while following those steps is to add these two arguments to your cmake command cmake <path-to-root-of-this-source-code> \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=<path-to-install> \
-DBUILD_ONLY="s3" \
-DFORCE_SHARED_CRT=OFF \
-DBUILD_SHARED_LIBS=OFF Please let me know if you still have any questions/problems with building this sdk statically. |
Hi @jmklix, thanks for the help again! When it comes to building the SDK from source, I always get stuck in the same place (unresolved external symbols, LNK 2001). I would like to do this in CMake-less way and instead set it up directly through Visual Studio 2022. My steps are as follows:
In Visual Studio, setting up the project properties (following #1154):
I can see that it recognizes my libraries in the executable folder, it recognizes the code from the header, but it still shows me LNK2001 errors: We did start a previous thread about it (#2734), but I do have another thread about it that may give you more information on this: #2669 Also, something else I noticed but thought might have been deprecated up until reading this rather recent post (#2421), I don't have a |
Hi @jmklix! I just wanted to update and close this thread as I found out what the issue was. In turns out, for either method of building the SDK (from source or from vcpkg), I needed more .libs and/or more preprocessor definitions. I don't know if every single one of them will be useful, but hopefully people can use this thread to check for every single permutation. For Preprocessor Definitions:
For Additional Dependencies (where Additional Library Directories points to the
Hope this helps people in the future! |
|
hello i have same problem,where Preprocessor Definitions you add to ?your own project vs configuration or aws-cpp-sdk-core? |
I had same problem with link functions from static libraries. |
It's really helpful |
Describe the bug
I would like to build an .exe through Visual Studio 2022 with AWS SDK for C++ using vcpkg libraries. I can currently do this with DLLs, but I want to instead build the .exe with static .libs. After doing the steps below, I see LNK2001 errors for every AWS function I try to use in the project:
This does put the expected files (.h, .lib) into vcpkg.
My vcpkg solution settings are as follows:
Then switched over to /MT instead of /MD:
And I also added the .libs as additional dependencies, just in case:
Thank you once again for all of the help! Hopefully this is the last question, and everything behaves!
Expected Behavior
I expect the .exe to be built properly with the vcpkg .libs.
Current Behavior
Reproduction Steps
Possible Solution
This does seem like a common issue that pops up, and I get find a post that is the exact same as mine (#1074). Unfortunately, the first link that is sent as a solution no longer exists, but that may be the solution to this. I'm sure I'm just missing some definition in the vcpkg solution page, but I'm unsure what it is.
Additional Information/Context
No response
AWS CPP SDK version used
Latest (1.11.162)
Compiler and Version used
Visual Studio 17 2022
Operating System and version
Windows 10, Version 22H2
The text was updated successfully, but these errors were encountered: