0

I starting an project using OpenGL in Linux (Ubuntu 13.10) and i have an basic source code from my professor that compiles in his computer.

When i treid to compile it here, (i have the open gl libraries working in other projects), i got the following error in terminal:

gcc -o quadtree quadtree.o glm.o winGL.o -lglut -lGL -lGLU
/usr/bin/ld: glm.o: referência indefinida ao símbolo 'acos@@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: ** [quadtree] Erro 1

("referência indefinida ao simbolo" means "undefined reference to symbol")

I searched in internet and got hints that this could be an error in the makefile, but i dont know what is wrong. There is my makefile:

.c.o:   $*.h
    gcc -c $*.c

.cpp.o: $*.h
    g++ -c $*.cpp

all:    quadtree

quadtree:  quadtree.o glm.o winGL.o 
    gcc -o $@ $^ -lglut -lGL -lGLU

clean:
    rm *.o *.*~ *~ quadtree

Is there any command missing?

Diedre
  • 515
  • 4
  • 21
  • 1
    You should improve your `Makefile`; see e.g. [this example](http://stackoverflow.com/a/14180540/841108) or [this one](http://stackoverflow.com/a/20146082/841108) – Basile Starynkevitch Jan 26 '14 at 19:14

1 Answers1

4

You forgot to link with -lm, see man acos

drahnr
  • 6,782
  • 5
  • 48
  • 75