I was working on a project in which I used g ++ to compile C code in files that end in .c. The reason is because they tell me that g ++ has the best warning messages.
I will move on to the build process for this project to use CMake. I found that CMake originally wanted to use gcc to compile C files. This failed due to things like declaring variables during use. So I tried using g ++ to compile C files using the parameter
set(CMAKE_C_COMPILER_INIT g++)
in the CMakeLists.txt file. But this leads to an error message:
I renamed my .c files to .cpp to fix this problem, since it seems to me that this is the easiest way to get everything working, and maybe the best way. But I was wondering if CMake can be used to use g ++ to compile C files.
gcc g ++ cmake
Gabriel southern
source share