1

我在这里没有找到与 FMOD 和 makefile 相关的帖子,我试图从 FMOD 论坛获得一些帮助,但他们的数据库已关闭。所以,就在这里。

我正在使用 Linux Ubuntu 12.04 LTS 32 位。我想将 FMOD 声音功能集成到空气曲棍球游戏中。我有正常运行的游戏,我有一个正常运行的“示例”。我不太精通各种 makefile 语法和制作 FMOD 应用程序,这就是我在这里的原因。

这是示例的生成文件:

x86: main.cpp
        g++ -O2 -m32 -o example $< ../../api/lib/libfmodex.so

x64: main.cpp
        g++ -O2 -m64 -o example $< ../../api/lib/libfmodex64.so

x86_c: main.c
        g++ -O2 -m32 -o example $< ../../api/lib/libfmodex.so

x64_c: main.c
        g++ -O2 -m64 -o example $< ../../api/lib/libfmodex64.so

clean:
        rm -f example

据我了解,示例 makefile 可以根据您使用的架构和语言确定要加载的内容。我不知道我应该将示例 makefile 中的哪些标志放入空气曲棍球 makefile 的哪个标志列表中。我怕把事情搞砸。

另外,我想确保游戏可以在任何机器上运行而无需参考,/usr/local/include并且/usr/local/lib机器上可能不存在。

新手来了 很感谢任何形式的帮助。

4

1 回答 1

1

该 makefile 将根据您告诉它的目标构建来自两个源文件之一的两个体系结构之一的示例二进制文件。选择是:

`x86` which builds a 32 bit program from the example C++ source file.
`x64` which builds a 64 bit program from the example C++ source file.
`x86_c` which builds a 32 bit program from the example C source file.
`x64_c` which builds a 64 bit program from the example C source file.

就使用 FMOD 构建游戏而言,该代码的主要部分是它在编译行中包含了适当的 FMOD 共享对象文件(尽管以我通常看不到的方式完成)。

您需要在游戏的编译命令中包含指向相应库的类似路径,或者(可能如果您使用的是已安装在系统上的 FMOD 库)您只需要在 gcc/g++ 中包含正确的-L-l标志)。-L告诉编译器在哪里搜索 FMOD 库并-l告诉它库名称是什么(-lfmodex或者-lfmodex64对于那些示例情况)。

于 2013-11-03T19:29:03.357 回答