开发平台(Platform): (Ex: VC++, GCC, Linux, ...)
linux gcc
额外使用到的函数库(Library Used): (Ex: OpenGL, ...)
问题(Question):
王者归来linux C书里面的范例 15-7
(这本真的错误很多)
虽然书上写 用-lpthread
但都没办法过 全部改用-pthread
喂入的资料(Input):
预期的正确结果(Expected Output):
the second thread
No . 2 clean-up procdure
.....
错误结果(Wrong Output):
cleanup.c:43:1: error: expected ‘while’ before ‘void’
void *tfn3(void *arg)
^
cleanup.c:84:36: error: ‘tfn3’ undeclared (first use in this function)
err = pthread_create(&tid3, NULL, tfn3, NULL);
cleanup.c:84:36: note: each undeclared identifier is reported only once for each function it appears in
cleanup.c:86:3: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=]
printf("cant create thread %s\n", strerror(err));
^
cleanup.c: In function ‘tfn2’:
cleanup.c:96:1: error: expected declaration or statement at end of input
}
^
cleanup.c:96:1: error: expected declaration or statement at end of input
程式码(Code):(请善用置底文网页, 记得排版)
https://github.com/hsuanchenli/C/blob/master/cleanup.c
补充说明(Supplement):
自己基础很差
不太会要怎样让它编译过
感谢各位大大