lundi 30 mars 2015

Syntax error when defining type aliases

When trying to define the simplest type alias I get the following error: syntax error : missing ';' before '=' on the 4th line. The code is quite simple:



#include "stdafx.h"
#include <iostream>
using namespace std;
//data type aliases - using
using C = char;
int _tmain(int argc, _TCHAR* argv[])
{
getchar();
return 0;
}


This does not happen if I use the typedef approach. What is the proper way/place to define the type alias by utilizing the using keyword and why this error occurs? I am using the VS 2010 C++ compiler.


Aucun commentaire:

Enregistrer un commentaire