In Xcode 4.5, what is “Compiler Default” for “C++ Standard Library” and “C++ Language Dialect”?

前端 未结 1 1830
野趣味
野趣味 2020-12-29 17:10

What is the value of \"Compiler Default\" for \"C++ Standard Library\" and \"C++ Language Dialect\" in Xcode 4.5?

My guess is libstdc++ and GNU++98, but it would be

相关标签:
1条回答
  • 2020-12-29 17:40

    Here is the best way to find out:

     #include <iostream>
    
    int main()
    {
    #ifdef _LIBCPP_VERSION
        std::cout << "Using libc++\n";
    #else
        std::cout << "Using libstdc++\n";
    #endif
    #ifdef __GXX_EXPERIMENTAL_CXX0X__
    #if __cplusplus == 1
        std::cout << "Language mode = gnu++11\n";
    #else
        std::cout << "Language mode = c++11\n";
    #endif
    #else
    #if __cplusplus == 1
        std::cout << "Language mode = gnu++98\n";
    #else
        std::cout << "Language mode = c++98\n";
    #endif
    #endif
    }
    

    Just build a test project with the compiler defaults and run it.

    0 讨论(0)
提交回复
热议问题