成都网站建设设计

将想法与焦点和您一起共享

BoostLinux线程第一课

#include

润州ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为成都创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:028-86922220(备注:SSL证书合作)期待与您的合作!

#include

void ThreadFunc()
{
        std::cout<<"enter thread func success!"<}

int main()
{
        boost::thread thrd1(&ThreadFunc);
        thrd1.join();
        return 0;
}

编译指令    g++  test.cpp  -lboost_thread

注意:没有链接boost_thread,出错提示如下:

undefined reference to `boost::system::generic_category()'
undefined reference to `boost::system::generic_category()'
undefined reference to `boost::system::system_category()'

undefined reference to `boost::system::system_category()'
undefined reference to `vtable for boost::detail::thread_data_base'
undefined reference to `vtable for boost::detail::thread_data_base'
undefined reference to `boost::thread::start_thread_noexcept()'
undefined reference to `boost::thread::detach()'
undefined reference to `boost::thread::native_handle()'
undefined reference to `boost::thread::join_noexcept()'
undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
undefined reference to `typeinfo for boost::detail::thread_data_base'


当前文章:BoostLinux线程第一课
分享地址:http://chengdu.cdxwcx.cn/article/pgesej.html