相关疑难解决方法(0)

c ++线程本地存储clang-503.0.40(Mac OSX)

在我以这种方式声明变量之后:

   #include <thread>
   namespace thread_space
    {
    thread_local int s;
    } //etc.
Run Code Online (Sandbox Code Playgroud)

我试图使用'g ++ -std = c ++ 0x -pthread [sourcefile]'编译我的代码.我收到以下错误:

example.C:6:8: error: thread-local storage is unsupported for the current target
static thread_local int s;
       ^
1 error generated.
Run Code Online (Sandbox Code Playgroud)

如果我尝试使用GCC 4.8.1在Linux上使用相同的标志编译相同的代码,我会得到一个正常运行的可执行文件.我在运行OSX 10.9.3的MacBook Pro上使用了clang-503.0.40(Xcode 5.1.1附带的那个).谁能解释一下我做错了什么?谢谢!!

macos xcode clang thread-local-storage c++11

16
推荐指数
1
解决办法
1万
查看次数

标签 统计

c++11 ×1

clang ×1

macos ×1

thread-local-storage ×1

xcode ×1