This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: math.h prob


:>I am fairly new to C programming, especially to using gcc, so I am sorry
:>if my question is a bit simple!
	<SNIP>
:>and try to compile it using,
:>gcc -o test mattest.c
:>I get the following error:
:>Undefined                       first referenced
:> symbol                             in file
:>sqrt                                /var/tmp/cc9Eay_r1.o

You need to link the math library to your program with the -lm option. I
recommend you don't call your program 'test', since this is a command:
gcc -o math_test mattest.c -lm

Haha!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]