Loading

g++编译多线程

因为thread是C++11新加入的特性,所以我们在用g++编译的时候不能直接用,需要在g++后面加上 -std=c++0x -pthread

如果是gcc编译多线程的话则应该要用 gcc xxx.c -lpthread来编译,因为pthread并不是linux库里面的

-lpthread 是在 -L 的路径下找名为 libpthread.so 的库,和什么-pthread、-pthreads这些编译参数是两码事

posted @ 2021-01-27 23:56  modao  阅读(588)  评论(0编辑  收藏  举报