简体   繁体   中英

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?

您忘记与-lm链接,请参阅man acos

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM