0
我正在写一个处理线程的程序,我几乎完全工作。不幸的是,我遇到了一个我不熟悉的语法错误(重复4次)。这里有一个快速剪断,它在我的编译的命令,并且错误后面:
不熟悉的错误
gcc -o threads threads.cpp -pthread<br>
/tmp/ccy8maS0.o: In function `tenPercentA()':
threads.cpp:(.text+0xde): undefined reference to `ceil'
/tmp/ccy8maS0.o: In function `tenPercentB()':
threads.cpp:(.text+0x1c6): undefined reference to `ceil'
/tmp/ccy8maS0.o: In function `fiftPercentC()':
threads.cpp:(.text+0x2ae): undefined reference to `ceil'
/tmp/ccy8maS0.o: In function `fiftPercentD()':
threads.cpp:(.text+0x396): undefined reference to `ceil'
/tmp/ccy8maS0.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
我已经包含在我的程序文件math.h库,和我使用的是正确的语法呼叫:
ceil(tempA);
其中tempA是一个double值,我需要向上取整。 有什么建议吗?我试过谷歌这些错误,但像大多数错误一样,很难找到与您的模式相同的具体示例。
编辑:我已经解决了所有与ceil相关的错误(在命令行上使用-lm),但最后一个错误依然存在,我不知道它是什么意思,或者如何解决它。
是的,只是想出了!谢谢:) 我也想出了导致最后一个错误的原因,AKA用gcc和g ++编译(我把文件保存在错误的扩展名中) – Baelix