APUE程序清单11-4(线程清理处理程序)编译通不过,请教原因

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


希望得到大家的指点,谢谢。

作者: fushaobing2010   发布时间: 2011-02-28

建议你把代码贴出来,不是所有人都有你说的这个代码

作者: dean_yanqing   发布时间: 2011-02-28

根据错误提示一个一个找,第一眼就感觉缺东少西,是不是环境没配置好?

作者: jiazhen   发布时间: 2011-02-28