0
試圖運行一些示例代碼。
但意外的事情發生了。
我不知道是否有任何已知的關於boost.thread與libC++一起使用的issus?C++ -std = C++ 11 -stdlib = libC++ with boost.thread給出分段錯誤:11在OSX上
計劃與-std=c++11
編譯或別無選擇,運行良好。
但是,當我與-stdlib=libc++
或-std=c++11 -stdlib=libc++
編譯輸出像:
in main
in thread
bash: line 1: 37501 Segmentation fault: 11 ./a.out
編譯:
蘋果LLVM版本4.2(基於LLVM 3.2svn)(鐺-425.0.28)
目標:x86_64的 - 蘋果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;
}
你如何編譯? – 2013-05-05 12:57:43
IIRC,我已經看到這個問題的地方(因爲我有一個類似的問題),但我不記得在哪裏...... :( – soon 2013-05-05 13:20:30
@BЈовић我只在終端使用'C++' – silvesthu 2013-05-05 14:25:05