Qt with VS 2013



  • Using this code:

    using LISTSTR = std::list< std::wstring>;
    

    I am getting these errors

    error: C2143: syntax error : missing ';' before '='
    error: C2873: 'LISTSTR' : symbol cannot be used in a using-declaration
    error: C2513: 'int' : no variable declared before '='

    This code compiles without any problems under VS2015/13



  • @Papa said:

    using LISTSTR = std::list< std::wstring>;

    Type alias declarations are C++11 features. C++11 is not (yet) enabled by default, so you have to turn it on by adding the following to your *.pro file: CONFIG += c++11



  • Qt Creator added that line in the .pro file.
    In my code I added

    #if ((_MSC_VER >= 1600) || (GCC_VERSION >= 40902))  //if C++11
        using LISTSTR = std::list< std::wstring>;
    #else
    	typedef std::list< std::string > LISTSTR;
    #endif
    

    The Creator Intelisence recognized the the statement with the 'using' key-word, but the compiler does not and issues a error message.


  • Moderators

    This post is deleted!

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.