I am using a CMake project, with CXXFLAGS = -std=c++11
In one of my header files, there was a legacy code the removed const
:
#ifdef unix
#define const
#endif
I then added this to test:
const int i = 0;
printf("%d\n", ++i);
The compilation on the VM flagged the error, so clearly unix
is not defined. I wondering who defined unix
for me. After some searching, it actually came from the gcc_Debug.h
file. This file says it is generated “based on my GCC”.
Question 1: If it compilation didn’t use the flag, why did the IntelliSense file added that flag?
If I removed the -std=c++11
, the compilation did not flag the error (interesting…). So maybe my GCC configuration did have unix
, but the c++11
flag removed it, but the visualgdb IntelliSense file didn’t capture this? (I’m new to Linux).
Question 2: If it’s my configuration problem, anything I can do to remedy this? It seems like I am not supposed to edit the IntelliSense file.