我想从http://pages.cs.wisc.edu/~travitch/pthreads_primer.html(Mutex部分)编译示例 pthread 代码。当我运行这个命令时:
gcc -pedantic -Wall -o theaded_program pth.c -lpthread
在链接中说明,我收到此错误
pth.c:45:5: warning: ISO C90 forbids mixed declarations and code [-pedantic]
/tmp/ccajksBv.o: In function `opponent':
pth.c:(.text+0x4a): undefined reference to `tan'
/tmp/ccajksBv.o: In function `main':
pth.c:(.text+0x131): undefined reference to `tan'
collect2: ld returned 1 exit status
但是#include <math.h>
代码中有没有!!gcc 版本是 4.6