code::blocks10.05调试多线程报错解决办法

来源:互联网 发布:win7万能网络驱动下载 编辑:程序博客网 时间:2024/05/22 13:56

linux下使用pthread 相关函数时,如果是使用makefile,需要LDFLAGS=-lpthread

但是使用code::blocks默认使用的makefile是没有这个选项的,所以在编译时会报错,undefined reference to pthread_create:

需要配置这个编译参数:

右击工程或选择project菜单-->project build option-->Linker settings-->other linker options加入:-pthread


再次编译通过!


原创粉丝点击