尝试定义最简单的类型别名时,出现以下错误:
syntax error : missing ';' before '='在第四行。
代码很简单:

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


如果我使用typedef方法,则不会发生这种情况。利用using关键字定义类型别名的正确方法/位置是什么,为什么会发生此错误?我正在使用VS 2010 C ++编译器。

最佳答案

这是定义类型别名的正确方法。 VS 2010不支持此功能,因此您需要进行升级才能使用它。

07-24 13:57