小编Lit*_*ear的帖子

使用带有mac os x的命令行中的clang和libc ++和c ++ 11

如果我启用c ++ 11和libc ++,我甚至无法使用clang编译一个简单的hello世界.例如以下代码

#include <iostream>

int main()
{
    std::cout << "Hello, World!" << std::endl;
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我运行时从编译生成以下输出 clang++ -std=c++11 -stdlib=libc++ main.cpp

In file included from main.cpp:1:
In file included from /usr/bin/../lib/c++/v1/iostream:38:
In file included from /usr/bin/../lib/c++/v1/ios:216:
In file included from /usr/bin/../lib/c++/v1/__locale:15:
In file included from /usr/bin/../lib/c++/v1/string:434:
In file included from /usr/bin/../lib/c++/v1/algorithm:591:
/usr/bin/../lib/c++/v1/type_traits:165:12: error: unknown type name
      '_LIBCPP_CONSTEXPR'
    static _LIBCPP_CONSTEXPR const _Tp      value = __v;
           ^
/usr/bin/../lib/c++/v1/type_traits:165:30: error: expected member name or ';'
      after declaration specifiers
    static _LIBCPP_CONSTEXPR const …
Run Code Online (Sandbox Code Playgroud)

c++ macos clang c++11 libc++

9
推荐指数
1
解决办法
8378
查看次数

标签 统计

c++ ×1

c++11 ×1

clang ×1

libc++ ×1

macos ×1