c++ - Mac OSX 构建中缺少 Allegro 5.2 TTF 插件

标签 c++ macos allegro allegro5

我正在尝试在我的 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。在 allegro 构建的 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/

相关文章:

c++ - 专门化非模板类的模板化构造函数

macos - 如何在 Mac OS X 中连接 NetBeans 8 和 Tomcat 8?

c++ - 在主函数之外退出程序

c++ - C++ 中的 vector 与数组?

c++ - 通过复制 include 目录的内容来安装 spdlog

macos - 卸载时清理 LaunchAgents

c++ - Visual Studio 2013 上的 Allegro 4.4.2 未处理异常

c++ - 在Allegro 5中使用多个计时器

c++ - C++ 中 dynamic_cast 运算符的强制必要性

macos - OSX 10.7.5 : fatal error: 'ft2build.h' file not found