clion msvc, cmake-> CMAKE_C_STANDARD 11 ->not working
when i create a source to use __STDC_VERSION__ and use cmake and set it to CMAKE_C_STANDARD 11 and use
msvc as compiler and cmake to generate nmake makefiles and use cmake --build so it 'will create a binary file' but
in clion ,it 'can not create a binary' when i select msvc x64 as compiler and set CMAKE_C_STANDARD 11
and use __STDC_VERSION__ in a source file.
nmake and cmake --build can create a binary with this cmake generated nmake makefiles but in clion,when i set CMAKE_C_STANDARD 11
it generate this error :
error C2065: '__STDC_VERSION__': undeclared identifier
NMAKE : fatal error U1077: 'C:\PROGRA~2\MICROS~1\2019\Preview\VC\Tools\MSVC\1428~1.298\bin\Hostx86\x86\cl.exe' : return code '0x2'
Stop.
i get this error too when out of clion ,i set CMAKE_C_STANDARD to 90 or 99. nmake can not create a binary .
but when i set to 11 nmake can create a binary but why in clion nmake can not create a binary?
like it not use 11 and use 90 or 99 in clion!
it will generate a binary with the attached files.
cmake -G "NMake Makefiles" .
nmake or cmake --build .
but in clion ,it can not generate a binary!
CMakeLists.txt
cmake_minimum_required(VERSION 3.17)
project(a1 C)
set(CMAKE_C_STANDARD 11)
add_executable(a1 0.c)
0.c
#include <stdio.h>
int main(void)
{
printf("%ld",__STDC_VERSION__);
return 0;}
请先登录再写评论。
The problem was solved by the user by updating CMake.