问题
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