// Copyright (C) 2001-2003
// William E. Kempf
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/thread/thread.hpp>
#include <iostream>
using namespace std;
void helloworld()
{
std::cout << "Hello World!" << std::endl;
}
int main()
{
boost::thread thrd(&helloworld);
thrd.join();
std::cout<<"sdfsfsd"<<endl;
}
从教程和许多其他示例中,我得到以下错误。
我在OS X 10.8.2上使用xcode 4.6.2,使用sudo端口安装了boost 1.54并链接了所有标头搜索路径和库并添加了dylib。有人能告诉我这是什么问题。没有连接,它有时会与文本“hello world”和“sdfsfsd”一起散布,因为它不等待线程完成,但有时也会给我这个错误。谢谢!
答案 0 :(得分:0)