Pluginterfaces.lib compilation error (win 10, VS 2022)

Hi! This is my first time dealing with c++ development and I ran into a problem the first time I tried to compile a project.
First i saw:

Error E0020 identifier "atomic_fetch_add" and "atomic_int_least32_t" is undefined

Then after several attempts to find a solution, I noticed the line:

The contents of <stdatomic.h> are available only with C++23 or later.

I’m confused because I haven’t found almost any information on how to fix it. I can’t choose the c++23 standard in the compiler configuration.
P.S. I tried to compile in the IDE and using cmake in the terminal, but it happens every time.

Somehow your installation is wrong or you did use the wrong folder to generate the SDK. <stdatomic.h> is part of c++11 (see Standard library header <stdatomic.h> - cppreference.com).
Which folder do you used for generating the project?
To build the SDK see the instructions here: GitHub - steinbergmedia/vst3sdk: VST 3 Plug-In SDK

Correct me if I did something wrong:

  1. I created a VST3 folder in the root of one of the hard drive

  2. installed cmake in a subfolder

  3. I put the vst3 sdk folder next to it

  4. using cmake-gui I configured and generated the project (the ‘build’ folder is located inside the ‘vst3sdk’ folder)

  5. opened the ‘vstsdk.sln’

  6. right clicked on one of plugin example and clicked ‘build’

Once again I will insert what I have at the output

1>The contents of <stdatomic.h> are available only with C++23 or later.
1>E:\VST3\vst3sdk\pluginterfaces\base\funknown.cpp(91,44): error C2061: syntax error: identifier 'atomic_int_least32_t'
1>Done building project "pluginterfaces.vcxproj" -- FAILED.
2>------ Build started: Project: validator, Configuration: Debug x64 ------
2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(1092,5): error MSB6006: "link.exe" exited with code 1104.
2>LINK : fatal error LNK1104: cannot open file '..\..\..\..\lib\Debug\pluginterfaces.lib'
2>Done building project "validator.vcxproj" -- FAILED.

same issue here. worked fine with vs 2019. updated to 2022 and got this error out of the box.

“not supported”

<stdatomic.h> is currently supported when compiled as C++ ( /std:c++latest ). It isn’t yet supported when compiled as C ( /std:c11 and /std:c17 )

Fix:

cmake -DSMTG_USE_STDATOMIC_H=OFF .

or

if (MSVC)
set(SMTG_USE_STDATOMIC_H OFF CACHE BOOL “” FORCE)
endif()

OK, so it looks like Visual Studio 2022 was updated lately to include this file. We will have a look if this is a cmake issue or if we need to change something. Thanks Mike737 for providing a solution until then.

It works! Thanks!

I pasted this into the CMakeLists.txt file but it didn’t work:

if (MSVC)
set(SMTG_USE_STDATOMIC_H OFF CACHE BOOL “” FORCE)
endif()

Then I put this:
-DSMTG_USE_STDATOMIC_H=OFF
into the custom build tool command line inside Visual Studio 2022 where it calls cmake. That didn’t work either. I’m not sure what I’m doing wrong here.

Any ideas?

Is there a solution for this yet?

Thanks