Sunday 15 June 2014

c++ - Error using alias declaration -



c++ - Error using alias declaration -

i'm trying compile easy programme utilize alias declaration.

this code:

#include <iostream> using namespace std; using in = int; in main () { in = 1; cout << << '\n'; homecoming 0; }

the command utilize compile g++ -std=c++0x program_name.cxx, using built-in terminal in kate on ubuntu os. doesn't work! suggestion? (instead using typedef int in; works).

compile in c++11 mode. type aliasing supported in c++11. suspect g++ version utilize older , doesn't back upwards c++11, hence fails c++0x.

compile with: g++ -std=c++11 file.cpp

and it works.

by way, seems terrible thought alias int in such way.

c++ alias

No comments:

Post a Comment