Diedre
Diedre

Reputation: 565

C Compilation error in Ubuntu 13.10, probably error in makefile

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?

Upvotes: 0

Views: 488

Answers (1)

drahnr
drahnr

Reputation: 6886

You forgot to link with -lm, see man acos

Upvotes: 4

Related Questions