Wic*_*ciu 4 c++ debian multithreading stdthread
得到这个问题 - 在标题..
我有这个代码:
#include <thread>
#include <iostream>
void my_thread_func()
{
std::cout<<"hello"<<std::endl;
}
int main()
{
std::thread t(my_thread_func);
t.join();
}
Run Code Online (Sandbox Code Playgroud)
从网站的某个地方.编译器选项-pthread -std = gnu ++ 0x(也试过-std = c ++ 0x)我有段错误.一切都在vmBox上的Debian上.我之前已经启动了其他代码,并且他们工作了.突然间,我在所有正在运行的应用程序中使用std :: thread进行了线程段错误.
编辑:这是来自gdb:
(gdb) where
#0 0x00000000 in ?? ()
#1 0x08048dc9 in thread<void (*)()> (this=0xbffff3fc,
__f=0x8048b9f <my_thread_func()>) at /usr/include/c++/4.4/thread:129
#2 0x08048bea in main () at ../test.cpp:18
Run Code Online (Sandbox Code Playgroud)
(当我用std :: thread t(&ClassName :: my_thread_func,ptr)启动更高级的应用程序时,错误是相同的,但是其他行[thread:133])
我正在网上搜索,但我没有找到合适的东西.
| 归档时间: |
|
| 查看次数: |
2491 次 |
| 最近记录: |