我试图在Mac OSX Sierra上编译基于Allegro的游戏,但出现以下错误:

Undefined symbols for architecture x86_64:
"_al_init_ttf_addon", referenced from:
__al_mangled_main in main.cpp.o


我从源代码编译了Allegro 5.2.3,这些是我包含在游戏CMakeLists.txt文件中的库。

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})


在Allegro 5.2.3 CMakeLists.txt中,设置了以下宏:

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)


构建和安装后,在/ usr / local / include中没有看到allegro_ttf.h,在该目录中安装了所有其他allegro头文件。我也没有在/ usr / local / lib下看到allegro_ttf.dylib。在用于快板构建的CMakeFiles / Makefile2中,我在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 / ttf / all。任何帮助,将不胜感激。

最佳答案

问题是我没有安装freetype

brew install freetype


现在正在工作!

关于c++ - Mac OSX版本中缺少Allegro 5.2 TTF插件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44480298/

10-12 20:22