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.
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.
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.