I am trying to compile an Allegro based game on my Mac OSX Sierra and I have the following error:
Undefined symbols for architecture x86_64:
"_al_init_ttf_addon", referenced from:
__al_mangled_main in main.cpp.o
I compiled Allegro 5.2.3 from source and these are the libraries I included in the CMakeLists.txt file for my game.
SET(LIBRARIES
liballegro.dylib
liballegro_acodec.dylib
liballegro_audio.dylib
liballegro_color.dylib
liballegro_dialog.dylib
liballegro_font.dylib
liballegro_image.dylib
liballegro_memfile.dylib
liballegro_main.dylib
liballegro_primitives.dylib)
include_directories(/usr/local/include)
link_directories(/usr/local/lib)
add_executable(My_Game ${SOURCE_FILES})
target_link_libraries(My_Game ${LIBRARIES})
In the Allegro 5.2.3 CMakeLists.txt I have the following macros set:
option(WANT_TTF "Enable TTF addon" on)
option(WANT_COLOR "Enable color addon" on)
option(WANT_MEMFILE "Enable memfile addon" on)
option(WANT_PHYSFS "Enable PhysicsFS addon" on)
option(WANT_PRIMITIVES "Enable primitives addon" on)
option(WANT_NATIVE_DIALOG "Enable native dialog addon" on)
option(WANT_VIDEO "Enable video player addon" on)
option(WANT_MONOLITH "Include all addons in the main library" off)
After building and installing I don't see allegro_ttf.h in /usr/local/include where all the other allegro headers are installed. I also don't see the allegro_ttf.dylib under /usr/local/lib. In the CMakeFiles/Makefile2 for the allegro build I see the following in Makefiles2:
# Convenience name for "all" pass in the directory.
addons/all: addons/primitives/all
addons/all: addons/image/all
addons/all: addons/font/all
addons/all: addons/audio/all
addons/all: addons/acodec/all
addons/all: addons/color/all
addons/all: addons/memfile/all
addons/all: addons/native_dialog/all
addons/all: addons/video/all
addons/all: addons/main/all
.PHONY : addons/all
But I don't see the addons/ttf/all. Any help would be appreciated.
The problem was I hadn't install freetype
brew install freetype
Now it is working!