joyeuse93
joyeuse93

Reputation: 1

C-makefile and external libraries

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

Upvotes: 0

Views: 211

Answers (1)

nullptr
nullptr

Reputation: 11058

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`

Upvotes: 2

Related Questions