Search code examples
c++aliastypedefusingvisual-studio-2013

How to use using for alias?


#include <iostream>
using namespace std;
using uchar = unsigned char;

int main() {
    cin.get();
}

This code results in error: syntax error : missing ';' before '='

How do I fix this (other than using typedef)? Doesn't Visual Studio 2013 support C++11?


Solution

  • Visual Studio does not support all of C++11 yet. For specific parts of C++11, you can see Herb Sutter's conformance roadmap for Visual C++. There you can see that using aliases are planned for VS2013 RTM

    Until then you will have to resort to the good old typedef