当前位置: 技术问答>linux和unix
APUE程序清单11-4(线程清理处理程序)编译通不过,请教原因
来源: 互联网 发布时间:2016-11-10
本文导语: APUE程序清单11-4(线程清理处理程序)编译通不过,请教原因。 下面是出错提示: sample11_4.c:19: error: expected identifier or ‘(’ before ‘while’ sample11_4.c:19: error: expected declaration specifiers or ‘...’ before ‘&’ to...
APUE程序清单11-4(线程清理处理程序)编译通不过,请教原因。
下面是出错提示:
sample11_4.c:19: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:19: error: expected declaration specifiers or ‘...’ before ‘&’ token
sample11_4.c:19: warning: data definition has no type or storage class
sample11_4.c:19: error: conflicting types for ‘__pthread_unregister_cancel’
/usr/include/pthread.h:664: error: previous declaration of ‘__pthread_unregister_cancel’ was here
sample11_4.c:19: error: expected identifier or ‘(’ before ‘if’
sample11_4.c:19: error: expected identifier or ‘(’ before ‘}’ token
sample11_4.c:19: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:21: error: expected identifier or ‘(’ before ‘return’
sample11_4.c:22: error: expected identifier or ‘(’ before ‘}’ token
[fsb@fu sample11_4]$ gcc -o sample11_4 sample11_4.c error.c -lpthread
sample11_4.c:19: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:19: error: expected declaration specifiers or ‘...’ before ‘&’ token
sample11_4.c:19: warning: data definition has no type or storage class
sample11_4.c:19: error: conflicting types for ‘__pthread_unregister_cancel’
/usr/include/pthread.h:664: error: previous declaration of ‘__pthread_unregister_cancel’ was here
sample11_4.c:19: error: expected identifier or ‘(’ before ‘if’
sample11_4.c:19: error: expected identifier or ‘(’ before ‘}’ token
sample11_4.c:19: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:20: error: expected identifier or ‘(’ before ‘do’
sample11_4.c:20: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:20: error: expected identifier or ‘(’ before ‘}’ token
sample11_4.c:20: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:20: error: expected declaration specifiers or ‘...’ before ‘&’ token
sample11_4.c:20: warning: data definition has no type or storage class
sample11_4.c:20: error: conflicting types for ‘__pthread_unregister_cancel’
/usr/include/pthread.h:664: error: previous declaration of ‘__pthread_unregister_cancel’ was here
sample11_4.c:20: error: expected identifier or ‘(’ before ‘if’
sample11_4.c:20: error: expected identifier or ‘(’ before ‘}’ token
sample11_4.c:20: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:21: error: expected identifier or ‘(’ before ‘return’
sample11_4.c:22: error: expected identifier or ‘(’ before ‘}’ token
sample11_4.c:34: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:34: error: expected declaration specifiers or ‘...’ before ‘&’ token
sample11_4.c:34: warning: data definition has no type or storage class
sample11_4.c:34: error: conflicting types for ‘__pthread_unregister_cancel’
/usr/include/pthread.h:664: error: previous declaration of ‘__pthread_unregister_cancel’ was here
sample11_4.c:34: error: expected identifier or ‘(’ before ‘if’
sample11_4.c:34: error: expected identifier or ‘(’ before ‘}’ token
sample11_4.c:34: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:35: error: expected identifier or ‘(’ before ‘do’
sample11_4.c:35: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:35: error: expected identifier or ‘(’ before ‘}’ token
sample11_4.c:35: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:35: error: expected declaration specifiers or ‘...’ before ‘&’ token
sample11_4.c:35: warning: data definition has no type or storage class
sample11_4.c:35: error: conflicting types for ‘__pthread_unregister_cancel’
/usr/include/pthread.h:664: error: previous declaration of ‘__pthread_unregister_cancel’ was here
sample11_4.c:35: error: expected identifier or ‘(’ before ‘if’
sample11_4.c:35: error: expected identifier or ‘(’ before ‘}’ token
sample11_4.c:35: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:36: error: expected declaration specifiers or ‘...’ before ‘(’ token
sample11_4.c:36: warning: data definition has no type or storage class
sample11_4.c:36: error: conflicting types for ‘pthread_exit’
/usr/include/pthread.h:234: error: previous declaration of ‘pthread_exit’ was here
sample11_4.c:37: error: expected identifier or ‘(’ before ‘}’ token
希望得到大家的指点,谢谢。
下面是出错提示:
sample11_4.c:19: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:19: error: expected declaration specifiers or ‘...’ before ‘&’ token
sample11_4.c:19: warning: data definition has no type or storage class
sample11_4.c:19: error: conflicting types for ‘__pthread_unregister_cancel’
/usr/include/pthread.h:664: error: previous declaration of ‘__pthread_unregister_cancel’ was here
sample11_4.c:19: error: expected identifier or ‘(’ before ‘if’
sample11_4.c:19: error: expected identifier or ‘(’ before ‘}’ token
sample11_4.c:19: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:21: error: expected identifier or ‘(’ before ‘return’
sample11_4.c:22: error: expected identifier or ‘(’ before ‘}’ token
[fsb@fu sample11_4]$ gcc -o sample11_4 sample11_4.c error.c -lpthread
sample11_4.c:19: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:19: error: expected declaration specifiers or ‘...’ before ‘&’ token
sample11_4.c:19: warning: data definition has no type or storage class
sample11_4.c:19: error: conflicting types for ‘__pthread_unregister_cancel’
/usr/include/pthread.h:664: error: previous declaration of ‘__pthread_unregister_cancel’ was here
sample11_4.c:19: error: expected identifier or ‘(’ before ‘if’
sample11_4.c:19: error: expected identifier or ‘(’ before ‘}’ token
sample11_4.c:19: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:20: error: expected identifier or ‘(’ before ‘do’
sample11_4.c:20: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:20: error: expected identifier or ‘(’ before ‘}’ token
sample11_4.c:20: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:20: error: expected declaration specifiers or ‘...’ before ‘&’ token
sample11_4.c:20: warning: data definition has no type or storage class
sample11_4.c:20: error: conflicting types for ‘__pthread_unregister_cancel’
/usr/include/pthread.h:664: error: previous declaration of ‘__pthread_unregister_cancel’ was here
sample11_4.c:20: error: expected identifier or ‘(’ before ‘if’
sample11_4.c:20: error: expected identifier or ‘(’ before ‘}’ token
sample11_4.c:20: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:21: error: expected identifier or ‘(’ before ‘return’
sample11_4.c:22: error: expected identifier or ‘(’ before ‘}’ token
sample11_4.c:34: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:34: error: expected declaration specifiers or ‘...’ before ‘&’ token
sample11_4.c:34: warning: data definition has no type or storage class
sample11_4.c:34: error: conflicting types for ‘__pthread_unregister_cancel’
/usr/include/pthread.h:664: error: previous declaration of ‘__pthread_unregister_cancel’ was here
sample11_4.c:34: error: expected identifier or ‘(’ before ‘if’
sample11_4.c:34: error: expected identifier or ‘(’ before ‘}’ token
sample11_4.c:34: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:35: error: expected identifier or ‘(’ before ‘do’
sample11_4.c:35: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:35: error: expected identifier or ‘(’ before ‘}’ token
sample11_4.c:35: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:35: error: expected declaration specifiers or ‘...’ before ‘&’ token
sample11_4.c:35: warning: data definition has no type or storage class
sample11_4.c:35: error: conflicting types for ‘__pthread_unregister_cancel’
/usr/include/pthread.h:664: error: previous declaration of ‘__pthread_unregister_cancel’ was here
sample11_4.c:35: error: expected identifier or ‘(’ before ‘if’
sample11_4.c:35: error: expected identifier or ‘(’ before ‘}’ token
sample11_4.c:35: error: expected identifier or ‘(’ before ‘while’
sample11_4.c:36: error: expected declaration specifiers or ‘...’ before ‘(’ token
sample11_4.c:36: warning: data definition has no type or storage class
sample11_4.c:36: error: conflicting types for ‘pthread_exit’
/usr/include/pthread.h:234: error: previous declaration of ‘pthread_exit’ was here
sample11_4.c:37: error: expected identifier or ‘(’ before ‘}’ token
希望得到大家的指点,谢谢。
|
pthread_clearup_push
这个写错了。应该是
pthread_cleanup_push
这个写错了。应该是
pthread_cleanup_push
|
建议你把代码贴出来,不是所有人都有你说的这个代码
|
根据错误提示一个一个找,第一眼就感觉缺东少西,是不是环境没配置好?
|
估计缺少头文件
sample11_4.c:19: error: expected identifier or ‘(’ before ‘while’
看看第19行是什么?
sample11_4.c:19: error: expected identifier or ‘(’ before ‘while’
看看第19行是什么?
|
应该是缺少某个库没安装