我正在尝试编译C和C++源代码.目前我通过将此行添加到cmake文件来使用C++ 0x标准的C++ add_definitions(-std=c++0x).
在编译期间,我收到以下警告:cc1: warning: command line option ‘-std=c++11’ is valid for C++/ObjC++ but not for C [enabled by default]并且此错误:error: ‘for’ loop initial declarations are only allowed in C99 mode在c代码中引用for循环.
我想知道如何在cmake文件中设置c代码的标准.