|
Static Libraries - reference undefined only for addons |
huguesdpdn
Member #16,616
January 2017
|
Hi ! I would like to compile my program on an UNIX distrib in static mode. But the compilation doesn't work when I try to use the addons functions. Did I miss something ? Here is some information that may help you: $> make $> tree $> cat Makefile COMPILER = gcc INCLUDES_DIR += -IINCLUDES COMPILER_FLAGS += -W -Wextra -Wall -Werror -Wfatal-errors SOURCES_FILES += main.c CC = $(COMPILER) all: $(NAME) $(NAME): $(OBJS) clean: fclean: clean re: fclean all .PHONY: all clean fclean re Here is how I compiled allegro-5.2.2 : All files about allegro: And some additional version information:
I am sure I am wrong, but where ? EDIT: Happy new Year !!
|
GullRaDriel
Member #3,861
September 2003
|
That may be taken out of the CC cmd and resolved one time for all $(pkg-config --cflags --libs allegro-5 allegro_acodec-5 allegro_audio-5 allegro_color-5 allegro_dialog-5 allegro_font-5 allegro_image-5 allegro_memfile-5 allegro_physfs-5 allegro_primitives-5 allegro_ttf-5 allegro_main-5) Like that: LIBS=$(pkg-config --cflags --libs allegro-5 allegro_acodec-5 allegro_audio-5 allegro_color-5 allegro_dialog-5 allegro_font-5 allegro_image-5 allegro_memfile-5 allegro_physfs-5 allegro_primitives-5 allegro_ttf-5 allegro_main-5) $(CC) -o $(NAME) $(CFLAGS) $(OBJS) $(LIBS) I edited: parenthesis around LIBS, and I don't think that specifying system lib path is needed so no -I "Code is like shit - it only smells if it is not yours" |
huguesdpdn
Member #16,616
January 2017
|
Hi GullRaDriel, thank for your quick reply. I also try your solution, but unfortunately it seems doesn't work First, notice that I remove "allegro_dialog-5", seems it's not available for my operating system. I set a LIB var as requested in my Makefile, but nothing. Inside this directory, I have a allegro5 directory containing: Unfortunately, always the same output as above when compiling. Any idea ? |
GullRaDriel
Member #3,861
September 2003
|
Try that way: If at that line in the make output: EDIT: that was already the problem since the line I took is from your first post. "Code is like shit - it only smells if it is not yours" |
huguesdpdn
Member #16,616
January 2017
|
Ok, I found why (maybe also because I am a bit stupid ). I used ADDONS, this means that when I compiled allegro, some flags were missing. So, If you want to use allegro with all addons, you must correctly configure cmake. First: Second: Third: Third (bis): Four: COMPILER = gcc INCLUDES_DIR += includes COMPILER_FLAGS += -W SOURCES_FILES += file_name1.c NAME = $(PROGRAM_NAME) all: $(NAME) $(NAME): $(OBJS) clean: fclean: clean re: fclean all .PHONY: all clean fclean re Five: So why it's was not working before ? |
|