我已经写了代码
#include <iostream>
#include <boost/thread/thread.hpp>
using namespace std;
void f1()
{
cout <<"Hello world, I'm a thread1!"<<endl;
}
int main()
{
boost::thread t1(&f1);
return 0;
}
并在qt creator
中的pro文件中添加了字符串LIBS + = -L / usr / lib / x86_64-linux-gnu -lboost_system
我发现了这些错误
build-test_not_qt_1-Desktop-Debug / main.o:-1:在函数
boost::detail::thread_data_base::thread_data_base()': /build-test_not_qt_1-Desktop-Debug/main.o:-1: In function
boost :: detail :: thread_data_base :: thread_data_base()&#39;: build-test_not_qt_1-Desktop-Debug / main.o:-1:在函数boost::thread::start_thread()': build-test_not_qt_1-Desktop-Debug/main.o:-1: In function
boost :: thread :: start_thread()&#39;: build-test_not_qt_1-Desktop-Debug / main.o:-1:在函数boost::thread::~thread()': build-test_not_qt_1-Desktop-Debug/main.o:-1: In function
boost :: thread ::〜thread()&#39;: build-test_not_qt_1-Desktop-Debug / main.o:-1:在函数boost::detail::thread_data<void (*)()>::~thread_data()': /usr/include/boost/thread/detail/thread.hpp:91: error: undefined reference to
boost :: detail :: thread_data_base :: ~thread_data_base()&#39; (.rodata._ZTIN5boost6detail11thread_dataIPFvvEEE [_ZTIN5boost6detail11thread_dataIPFvvEEE] + 0x10): - 1:错误:未定义引用`typeinfo for boost :: detail :: thread_data_base&#39; :-1:错误:collect2:错误:ld返回1退出状态
我该如何修复它们?以及如何使应用程序正常工作?
答案 0 :(得分:2)
$string = '3-1-0-1.11,3-1-1-1.12,3-1-2-1.13,3-1-3-1.14,3-2-0-1.02,3-2-1-1.03,3-2-2-1.04,3-2-3-1.05,3-2-4-1.06,3-3-0-3.23,3-3-1-3.24,3-3-2-3.25,3-3-3-3.26';
foreach(explode(',', $string) as $tpl) {
$tpl = explode('-', $tpl);
$tpl[3] = explode('.', $tpl[3]);
$result[$tpl[1]][$tpl[2]][$tpl[3][0]] = !empty($tpl[3][1]) ? $tpl[3][1] : null;
}
var_dump($result);