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


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

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

需要配置这个编译参数:

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

再次编译通过!

相关内容