value *= pow(10, 3); // this one compiles
value *= pow(10, aVar); // this one produces this error:
//Number.c:(.text+0x469): undefined reference to `pow'
aVar is an int variable.
What could it be?
I'm using a makefile. I'm excecuting "make lexanc" My makefile looks like this:
lexanc: lexandr.o lexanc.o scanner.o printtoken.o token.h lexan.h Number.o
cc -o lexanc -lm lexandr.o lexanc.o scanner.o printtoken.o Number.o
...
Number.o: Number.c Number.h lexan.h
cc -c Number.c
lexanc.o: lexanc.c token.h lexan.h Number.h
cc -c lexanc.c
...
My cc version is: laygr@xxx$ cc --version cc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Libraries should come after all the objects in the compiling option. Change it to:
lexanc: lexandr.o lexanc.o scanner.o printtoken.o token.h lexan.h Number.o
cc -o lexanc lexandr.o lexanc.o scanner.o printtoken.o Number.o -lm
Note -lm
has been moved to the end.