CodeBlock編译boost thread程序

来源:互联网 发布:nginx 全局 header 编辑:程序博客网 时间:2024/06/08 18:30

如果出现:

/usr/lib/libpthread.a(pthread_create.o)||In function `pthread_create':|
(.text+0xa2f)||undefined reference to `_dl_stack_flags'|
/usr/lib/libpthread.a(pthread_create.o)||In function `pthread_create':|
(.text+0xbe5)||undefined reference to `_dl_stack_flags'|
/usr/lib/libpthread.a(ptw-pause.o)||In function `__pause_nocancel':|
(.text+0x18)||undefined reference to `__syscall_error'|
/usr/lib/libpthread.a(ptw-pause.o)||In function `__pause_nocancel':|

解决发方法:

CODEBLOCKS 链接器设置项中添加libpthread.a,查找到该文件在/usr/lib

命令行编译中要加 -lpthread参数
    gcc thread.c -o thread -lpthread
    thread.c为你些的源文件,不要忘了加上头文件#include<pthread.h>

----------------------------------------------

如果出现

/usr/lib/libpthread.a(pthread_create.o): In function `allocate_stack':
/build/buildd/glibc-2.6.1/build-tree/glibc-2.6.1/nptl/allocatestack.c:411: undefined reference to `_dl_stack_flags'
/build/buildd/glibc-2.6.1/build-tree/glibc-2.6.1/nptl/allocatestack.c:547: undefined reference to `_dl_stack_flags'

 

CODEBLOCKS 链接器设置项中添加libc.a,查找到该文件在/usr/lib

 

 

 

原创粉丝点击