![](/img/trans.png)
[英]c++ -std=c++11 -stdlib=libc++ giving errors on osx lion
[英]c++ -std=c++11 -stdlib=libc++ with boost.thread gives Segmentation fault: 11 on OSX
試圖運行一些示例代碼。
但是發生了意外情況。
我想知道關於與libc ++一起使用的boost.thread的已知問題嗎?
使用-std=c++11
編譯或沒有選項運行的程序運行良好。
但是當我使用-stdlib=libc++
或-std=c++11 -stdlib=libc++
輸出如下:
in main
in thread
bash: line 1: 37501 Segmentation fault: 11 ./a.out
編譯器:
Apple LLVM版本4.2(clang-425.0.28)(基於LLVM 3.2svn)
目標:x86_64-apple-darwin12.3.0
螺紋型號:posix
操作系統:Mac OS X 10.8.3
示例代碼非常簡單:
#include "stdio.h"
#include <boost/thread/thread.hpp>
class callable
{
public:
void operator()()
{
printf("in thread\n");
}
};
int main()
{
boost::thread t = boost::thread(callable());
printf("in main\n");
t.join();
return 0;
}
boost.thread可能鏈接到libstdc ++。 libstdc ++和libc ++具有不兼容的ABI。 它們不應該在一個程序中同時使用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.