aws/aws-iot-device-sdk-cpp-v2

compile sdk in vs 2019 and 2022

asafgolombek opened this issue · 6 comments

Confirm by changing [ ] to [x] below:

i want to compile the sdk in vs 2022 but i get an error 'Traits': template parameter name cannot be redeclared.
can you help me?

What steps are you taking to compile this and can you include the full error?

Hi there, I was having the same issue and managed to successfully compile by doing the following:

  • In project properties, set "C/C++ > Language > Conformance mode" to No (/permissive).

I'm unsure of how this addresses the issue described above, but it's something you can try out as it worked for me. Hope this helps.

The error was attributed to the file StringView.h on line 861.

The full end-to-end flow of compilation steps for using this library in a Visual Studio 2019 project were as follows:

  1. Build C++ AWS IoT SDK dependencies within short path (e.g. C:\dev\iotsdk)
mkdir sdk-cpp-workspace
cd sdk-cpp-workspace
git clone --recursive https://github.com/aws/aws-iot-device-sdk-cpp-v2.git
mkdir aws-iot-device-sdk-cpp-v2-build
cd aws-iot-device-sdk-cpp-v2-build
cmake -DCMAKE_INSTALL_PREFIX="C:\dev\iotsdk\sdk-cpp-workspace" ../aws-iot-device-sdk-cpp-v2
cmake --build . --target install --config "Release"
  1. In project properties, set "C/C++ > General > Additional Include Directories" to C:\dev\iotsdk\sdk-cpp-workspace\include
  2. In project properties, set "Linker > Input > Additional Dependencies" to:
C:\dev\iotsdk\sdk-cpp-workspace\lib\aws-crt-cpp.lib
C:\dev\iotsdk\sdk-cpp-workspace\lib\aws-c-mqtt.lib
C:\dev\iotsdk\sdk-cpp-workspace\lib\aws-c-event-stream.lib
C:\dev\iotsdk\sdk-cpp-workspace\lib\aws-checksums.lib
C:\dev\iotsdk\sdk-cpp-workspace\lib\aws-c-s3.lib
C:\dev\iotsdk\sdk-cpp-workspace\lib\aws-c-auth.lib
C:\dev\iotsdk\sdk-cpp-workspace\lib\aws-c-http.lib
C:\dev\iotsdk\sdk-cpp-workspace\lib\aws-c-io.lib
Secur32.lib
Crypt32.lib
C:\dev\iotsdk\sdk-cpp-workspace\lib\aws-c-compression.lib
C:\dev\iotsdk\sdk-cpp-workspace\lib\aws-c-cal.lib
NCrypt.lib
C:\dev\iotsdk\sdk-cpp-workspace\lib\aws-c-sdkutils.lib
C:\dev\iotsdk\sdk-cpp-workspace\lib\aws-c-common.lib
BCrypt.lib
Kernel32.lib
Ws2_32.lib
Shlwapi.lib
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
comdlg32.lib
advapi32.lib
  1. In project properties, set "C/C++ > Language > Conformance mode" to No (/permissive). Otherwise, when you try to execute a build, you will get an error for the file StringView.h on line 861:
Error	C7527	'Traits': template parameter name cannot be redeclared

This is also happening on the non-IoT C++ sdk. There is some compatibility issues with C++20, so for now please use C++17. We are working on a fix and will update here once that is out.

We have added some tests for building with the latest version of visual studio and I can't reproduce this error anymore. Can you update to the latest version of this sdk and see if you still have any problems compiling?

@jmklix i tried and everything is working, no errors - thanks!

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.