pthread 编程笔记

来源:互联网 发布:python生成随机数 编辑:程序博客网 时间:2024/06/10 01:37

1· 源文件中包含了pthread.h头文件,在编译是却报pthread_create和pthread_join未定

出问题的编译命令:gcc -lpthread -o a.out pthraed_eg_test.c

解决问题的编译命令:gcc -pthread -o a.out pthread_eg_test.c 或 g++ -o pthread_mutex_test.cpp pthread_mutex_test -lpthread

主要原因是编译器没有链接上pthread库,所以找不到库接口定义

原创粉丝点击