码迷,mamicode.com
首页 > 其他好文 > 详细

g++4.8.2的thread问题

时间:2014-08-05 14:30:20      阅读:231      评论:0      收藏:0      [点我收藏+]

标签:使用   os   io   for   问题   ar   c++   size   

c++11支持多线程,底层还是使用的lphtread,所以编译的时候需要加上相关的一些参数。

下面是我使用codeblokcs编译成功的例子

第一行是编译参数  需要 -std=c++11  lpthread

第二行是链接参数   需要 -Wl,--no-as-needed  -lpthread


-------------- Build: Debug in thread (compiler: GNU GCC Compiler)---------------

g++ -Wall -fexceptions -g -std=c++11 -lpthread -lphtread -I/usr/local/include/boost -c /root/codewok/thread/main.cpp -o obj/Debug/main.o
g++ -L/usr/local/lib -o bin/Debug/thread obj/Debug/main.o  -Wl,--no-as-needed -lboost_system -lboost_thread -lpthread  
Output file is bin/Debug/thread with size 107.79 KB
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 

-------------- Run: Debug in thread (compiler: GNU GCC Compiler)---------------

Checking for existence: /root/codewok/thread/bin/Debug/thread
Executing: gnome-terminal --disable-factory -t thread -x  /usr/bin/cb_console_runner LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. /root/codewok/thread/bin/Debug/thread  (in /root/codewok/thread/.)
Process terminated with status 0 (0 minute(s), 1 second(s))
 


g++4.8.2的thread问题,布布扣,bubuko.com

g++4.8.2的thread问题

标签:使用   os   io   for   问题   ar   c++   size   

原文地址:http://my.oschina.net/1987times/blog/298065

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!