1

I am new to the Unix system; have been trying to install and compile a code using a Makefile, but I get the following error:

gcc -o ../zmass zmass.o useful.o open.o -O3 `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0`
/usr/bin/ld: zmass.o: undefined reference to symbol 'pow@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [../zmass] Error 1

Could anybody help me with this? I have already installed gtk+-2.0.

jayant
  • 2,349
  • 1
  • 19
  • 27
Ana
  • 131
  • 3

1 Answers1

0

You need to add -lm after `pkg-config --libs gtk+-2.0` in your Makefile

jayant
  • 2,349
  • 1
  • 19
  • 27
  • thanks! that solved the problem. Could you please explain a bit about the significance of introducing -lm? – Ana Nov 14 '15 at 08:01
  • @Ana See [this answer](http://stackoverflow.com/a/1033940/1517864) to the the question [Why do you have to link the math library in C?](http://stackoverflow.com/q/1033898/1517864) – jayant Nov 14 '15 at 09:45