Friday, October 10, 2008

Simple compiling with gcc

Having trouble with a simple compile:

gcc -o data data.c
/tmp/ccCAfDR5.o: In function `main':
data.c:(.text+0x4c): undefined reference to `exp'
collect2: ld returned 1 exit status

Then:

gcc -lm -o data data.c

And it works, because math.h is just a header file and you need to link with the math's library.

No comments: