|
Problems compiling allegro game. Probably a linking error. Libraries? |
miner_tom
Member #16,065
August 2015
|
Hi, I am new to game programming with Allegro. I have downloaded a very popular game program called "blasteroids". When I try to use the make file to compile the program I get an error that very much seems related to libraries: "undefined reference to symbol 'cos@@GLIBC_2.2.5' I have done research online and found that this problem is usually due to the order in which libraries are presented to gcc for linking. I went looking for the allegro libraries, where the makefile suggests, which is /usr/lib and I found no .so files specifically related to allegro. Is there something wrong with my installation of allegro? Thank You |
Peter Hull
Member #1,136
March 2001
|
Do you mean 'DSO missing from command line'? Can you post the linker command line? (or, where is the source for Blasteroids that you're using?)
|
miner_tom
Member #16,065
August 2015
|
Hi, of course you are correct. The error is "undefined reference to symbol 'cos@@GLIBC_2.2.5" The linking section from the Makefile is as follows: CXX=gcc Thank You |
Peter Hull
Member #1,136
March 2001
|
It might be as simple as adding '-lm' to the definition of LDFLAGS, i.e. LDFLAGS=-L/usr/lib -lallegro -lallegro_primitives -lallegro_audio -lallegro_acodec -lallegro_font -lallegro_ttf -lallegro_main -lm Try it!
|
miner_tom
Member #16,065
August 2015
|
OMG! That was amazing! I had tried that but I had added the -lm to the line of the LDFLAGS(1) variable: LDFLAGS1=-L/usr/lib -lallegro -lallegro_primitives -lm That did not work. However, adding the -lm after the LDFLAGS variable DID work. Interesting. Can you tell me why, just for my own education? Thank You |
Peter Hull
Member #1,136
March 2001
|
I googled for 'blasteroid allegro' and it turns out there are 2 or 3 games with that name, but using the bit of the makefile you posted, I guessed it was this one: ... and from looking at the makefile I saw that LDFLAGS is used in linking the executable blasteroid: $(OBJS) $(CXX) $(OBJS) -o $(OUT) $(INCLUDE) $(CFLAGS) $(LDFLAGS) and LDFLAGS1 is only used for some kind of test program and so is irrelevant test_collision: test_collision.o utils.o bbox.o $(CXX) test_collision.o utils.o bbox.o -o test_collision $(INCLUDE) $(CFLAGS) $(LDFLAGS1) I've done the same thing myself (many times!) - for some reason, not all GCCs need you to put -lm in the linker flags, and you only find out it's missing when you try to build on another system.
|
|