Undefined reference to log10 function

戏子无情 提交于 2019-12-22 05:58:32

问题


I am building using Eclipse Kepler, and have included math.h. However, I am getting an error

'undefined reference to log10'.

Also types uint8_t and unit32_t are not being resolved. I have included both stdint.h and inttypes.h, just to be sure, but wasn't successful. Can someone kindly help?


回答1:


'undefined reference to log10'.

Because, the header file only provides the forward declaration of the function. The actual function definition is present in the ("math") library. You need to link with the math library using -lm.

Reference: man page for log10

Also, AFAIK, uint<N>_t are present in <stdint.h>. Please check for the existence for the header file itself and/or any typos (like unit32_t in your example) in your code.



来源:https://stackoverflow.com/questions/31403210/undefined-reference-to-log10-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!