How do I use pow() and sqrt() function in Ubuntu? I have inc开发者_运维百科luded the math.h header file but it still gives me an error.
Try adding -lm
to your linker command. Most of the math functions live in libm
which needs to be explicitly linked in.
Link to libm.so, adding -lm to the compiler command line parameters.
精彩评论