Where should I put -lm to include math.h library in my project?
@clear
@echo
@echo Compiling
@cc -c rpn.c
@cc -c stos.c
@cc rpn.o stos.o
@rm -f *.o
@echo Compilation success
Functions from math.h are defined in libm
library. To add a library, one should specify -l<name>
parameter for the linker, where <name>
is name of the library without the lib
prefix. So just add -lm
parameter to the linking command:
`cc rpn.o stos.o -lm`
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.