Val*_*ron 10 c++ linux multithreading c++11
浏览C++ 0x书中的货币并认为我会给出示例代码.它是基本的.
#include <iostream>
#include <thread>
void hello()
{
std::cout<<"Hello Concurrent World\n";
}
int main(int argc, char *argv[])
{
std::thread t(hello);
t.join();
}
Run Code Online (Sandbox Code Playgroud)
编译:
g++ -std=c++0x -g -o pgm pgm.cpp
Run Code Online (Sandbox Code Playgroud)
热潮:
Program received signal SIGSEGV, Segmentation fault.
_dl_fixup (l=0x7ffff7b0992c, reloc_arg=<value optimized out>) at ../elf/dl-runtime.c:147
147 ../elf/dl-runtime.c: No such file or directory.
in ../elf/dl-runtime.c
Run Code Online (Sandbox Code Playgroud)
似乎是某种设置/库问题.有人熟悉这个吗?
nos*_*nos 20
您需要使用-pthread标志编译/链接.
| 归档时间: |
|
| 查看次数: |
1956 次 |
| 最近记录: |