Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Makefile and AllegroFont

This thread is locked; no one can reply to it. rss feed Print
Makefile and AllegroFont
zelda007
Member #12,303
October 2010

Hi everybody !

I try to compile my program with AllegroFont 2.0.9 (last version) under Ubuntu 10.
But when I run my makefile (without forgot -lalfont param ;)) :

#SelectExpand
1[...] 2export LDFLAGS += -lalfont `allegro-config --libs` ./lib/libfmod-3.75.so 3 4EXEC = Zeldaa 5OBJECTS = main.o 6 7%.o: %.cpp *.hpp 8 @echo "\033[34m$(CXX) $< -> $@\033[0m";\ 9 $(CXX) $(CXXFLAGS) -c $< -o $@ 10 11%.o: %.cpp *.h 12 @echo "$(CXX) $< -> $@\033[0m";\ 13 $(CXX) $(CXXFLAGS) -c $< -o $@ 14 15%.o: %.c *.h 16 @echo "$(CC) $< -> $@\033[0m";\ 17 $(CC) $(CFLAGS) -c $< -o $@ 18 19$(EXEC): $(OBJECTS) 20 @echo "\033[32m$(LD) ($(OBJECTS)) -> $(EXEC)\033[0m";\ 21 $(LD) $(LDFLAGS) $(OBJECTS) -o $@ 22 23[...]

I have some errors alfer compiling (during the linking) :

Quote:

/mnt/partage/log/font.cpp:20: undefined reference to `alfont_load_font'
/mnt/partage/log/font.cpp:21: undefined reference to `alfont_load_font'
/mnt/partage/log/font.cpp:22: undefined reference to `alfont_set_font_size'
/mnt/partage/log/font.cpp:23: undefined reference to `alfont_set_font_size'
/mnt/partage/log/font.cpp:20: undefined reference to `alfont_load_font'
/mnt/partage/log/font.cpp:21: undefined reference to `alfont_load_font'
/mnt/partage/log/font.cpp:22: undefined reference to `alfont_set_font_size'
/mnt/partage/log/font.cpp:23: undefined reference to `alfont_set_font_size'
log/font.o: In function `~t_data':
/mnt/partage/log/font.cpp:47: undefined reference to `alfont_destroy_font'
/mnt/partage/log/font.cpp:48: undefined reference to `alfont_destroy_font'
/mnt/partage/log/font.cpp:47: undefined reference to `alfont_destroy_font'
/mnt/partage/log/font.cpp:48: undefined reference to `alfont_destroy_font'
message.o: In function `t_message::_preparerTexte()':
/mnt/partage/message.cpp:75: undefined reference to `alfont_text_length'
message.o: In function `t_message::_affecterTexte()':
/mnt/partage/message.cpp:114: undefined reference to `alfont_textprintf_aa'
/mnt/partage/message.cpp:135: undefined reference to `alfont_textprintf_aa'
fonctions.o: In function `initialiserAllegro(int, int, int)':
/mnt/partage/fonctions.cpp:1096: undefined reference to `alfont_init'
main.o: In function `main':
/mnt/partage/main.cpp:787: undefined reference to `alfont_exit'
collect2: ld returned 1 exit status

Have you got any idea ?

Thanks :)

Arthur Kalliokoski
Second in Command
February 2005
avatar

Isn't "./lib/libfmod-3.75.so" supposed to be "-lfmod-3.75" ?

[EDIT]

Oh, you had a subdirectory with it.

They all watch too much MSNBC... they get ideas.

zelda007
Member #12,303
October 2010

Yes, but there is no problem with fmod :)
Any ideas ?

Evert
Member #794
November 2000
avatar

Oh, you had a subdirectory with it.

Even then it should have been `-lfmod-3.75 -Llib`.

zelda007 said:

Any ideas ?

Try placing the libraries after the object files on the linker command line.

A cosmetic remark about your Makefile: use LIBS for the libraries you want to link to, use LDFLAGS for any other options you want to pass to the loader (debug/profile options, for instance). Don't export the variable (although I don't think it actually hurts).

zelda007
Member #12,303
October 2010

It doesn't work :(

But I have found the solution, it was a probleme with the install of Alfont :D (what a dumb I am)

Evert said:

A cosmetic remark about your Makefile: use LIBS for the libraries you want to link to, use LDFLAGS for any other options you want to pass to the loader (debug/profile options, for instance). Don't export the variable (although I don't think it actually hurts).

Can you give me an example about what you say ? I'm not comfortable with Makefile...

Go to: