Minimal reproducible example:
- In CLion, using the MinGW toolchain (version
w64 6.0
, withg++ 8.1.0
), create a new project with the "C++ executable" template - Write the following in
CMakeLists.txt
:cmake_minimum_required(VERSION 3.17) project(codeforces) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -x c++") add_executable(codeforces main.cpp)
- Write the following program in
main.cpp
:int main() { return 0; }
- Build the project with the default configuration
At the linking stage, I get a bunch of stray [...] in program
errors:
CMakeFiles\codeforces.dir/objects.a:2:59: error: stray '`' in program
/ 1598178122 0 0 0 14 `
[...]
But, if I remove the -x c++
flag, I don't get this error anymore, and everything builds fine. Why is this?