Is linux a C++ keyword on Linux OS? [duplicate]

  c++, linux

As I know, "linux" is not a C++ keyword, I use CentOS 6.5 X64 and g++ (GCC) 4.4.7 20120313,
the code in test.cpp is:

#include <iostream>

using namespace std;

int main( )
{
   int linux = 10;
   cout << linux <<endl;
   return 0;
}

But g++ throws an error:

[[email protected] ~/cplusplus]#g++ test.cpp
test.cpp: In function ‘int main()’:
test.cpp:7: error: expected unqualified-id before numeric constant

If I change ‘linux’ to ‘Linux’ or other word, it works.

When I compile the same code on Windows with Dev-C++, there is no this problem.

Has it had relation to operating system ?

Source: Windows Questions C++

LEAVE A COMMENT