How to link math.h library in geany?

安稳与你 提交于 2019-12-11 06:59:50

问题


SO I startedd coding with geany but every time i use the library math.h and then use somthing like pow or powf it marks me an error.

I do realize that when compiling i have to use -lm in the terminal but is there a way to make it so that geany will automatically use -lm when compiling in geany?

Thank you! c:


回答1:


Add -lm to compiler command configuration done under Build->Set Build Commands. you could also build a a makefile your file.




回答2:


You can't add the math.h to your program since it is a header file. But the functions defined in math.h are implemented in the libm.a.

You should add -lm to your compiler call to avoid this link error.



来源:https://stackoverflow.com/questions/27183812/how-to-link-math-h-library-in-geany

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