代码如下:
#include <string>
#include <iostream>
#include <thread>
using namespace std;
void test(){
cout << "thread .........." << endl;
}
int main(){
std::thread t=std::thread(&test);
t.join();
cout << "**********" << endl;
return 1;
}
有问题的编译及输出:
arm-hisiv400-linux-gnueabi-g++ ex1.cpp -o ex1 -std=c++11 -pthread
./ex1
pure virtual method called
terminate called without an active exception
Aborted
正确的编译及输出
arm-hisiv400-linux-gnueabi-g++ ex1.cpp -o ex1 -std=c++11 -pthread -mcpu=cortex-a7
~/gb # ./ex1
thread ..........
**********