XCode Boost线程示例编译错误

时间:2012-08-15 15:22:51

标签: multithreading boost boost-thread xcode4.4

这是我的基本提升代码

#include <iostream>
#include <boost/thread.hpp>

using namespace boost;
using namespace boost::this_thread;
using namespace std;
// Global function called by thread
void GlobalFunction()
{
    for (int i=0;i<10;++i)
    {
        cout << i << "Do something in parallel with main method." << endl;
        boost::this_thread::yield();
    }
}
void GlobalThreadTest()
{
    boost::thread t(&GlobalFunction);
    for (int i = 0; i<10; ++i) {
        cout << i << "Do something in main method. " << endl;
    }
}

int main(int argc, const char * argv[])
{
    GlobalThreadTest();
    return 0;
}

我从xcode那里得到了很多这样的错误

  

(null):“boost :: this_thread :: yield()”,引自:   (null):“boost :: detail :: thread_data_base :: ~thread_data_base()”,   引自:(null):“boost :: system :: system_category()”,   引自:(null):“boost :: system :: generic_category()”,   引用自:(null):“boost :: thread :: start_thread()”,引用   从:

我已经使用macports安装了boost,并且xcode中的头部搜索路径设置为 /选择/本地/包括/ 这包含所有.hpp文件。

2个问题

  1. 如果存储会创建* .o文件吗?
  2. 如何让xcode 4.2与此boost线程示例一起使用?如果有一个标志我必须设置,xcode 4.2中的哪个参数我将其设置为?
  3. 感谢。

0 个答案:

没有答案