gpt4 book ai didi

c++ - FMOD 播放流示例

转载 作者:太空宇宙 更新时间:2023-11-04 13:47:40 25 4
gpt4 key购买 nike

我想播放一个 mp3 文件,所以我搜索并了解了 FMOD。我下载了http://www.fmod.org/download/ (用于 Linux 的 FMOD Studio 程序员 API)。

我还收到关于 fmod.hpp not found 的错误,所以我将 inc 文件夹中的所有头文件复制到 examples 文件夹并删除了它们,但我现在明白了。

现在我尝试编译 play_stream.cpp 示例,但我明白了,但我完全不知道我在看什么。任何人都可以解释我做错了什么吗?

$ gcc play_stream.cpp
/tmp/ccCYnnTg.o: In function `main':
play_stream.cpp:(.text+0x24): undefined reference to `Common_Init(void**)'
play_stream.cpp:(.text+0x40): undefined reference to `ERRCHECK(FMOD_RESULT)'
play_stream.cpp:(.text+0x54): undefined reference to `FMOD::System::getVersion(unsigned int*)'
play_stream.cpp:(.text+0x64): undefined reference to `ERRCHECK(FMOD_RESULT)'
play_stream.cpp:(.text+0x8b): undefined reference to `Common_Fatal(char const*, ...)'
play_stream.cpp:(.text+0xaf): undefined reference to `FMOD::System::init(int, unsigned int, void*)'
play_stream.cpp:(.text+0xbf): undefined reference to `ERRCHECK(FMOD_RESULT)'
play_stream.cpp:(.text+0xcb): undefined reference to `Common_MediaPath(char const*)'
play_stream.cpp:(.text+0xf5): undefined reference to `FMOD::System::createSound(char const*, unsigned int, FMOD_CREATESOUNDEXINFO*, FMOD::Sound**)'
play_stream.cpp:(.text+0x105): undefined reference to `ERRCHECK(FMOD_RESULT)'
play_stream.cpp:(.text+0x119): undefined reference to `FMOD::Sound::getNumSubSounds(int*)'
play_stream.cpp:(.text+0x129): undefined reference to `ERRCHECK(FMOD_RESULT)'
play_stream.cpp:(.text+0x14d): undefined reference to `FMOD::Sound::getSubSound(int, FMOD::Sound**)'
play_stream.cpp:(.text+0x159): undefined reference to `ERRCHECK(FMOD_RESULT)'
play_stream.cpp:(.text+0x18f): undefined reference to `FMOD::System::playSound(FMOD::Sound*, FMOD::ChannelGroup*, bool, FMOD::Channel**)'
play_stream.cpp:(.text+0x19f): undefined reference to `ERRCHECK(FMOD_RESULT)'
play_stream.cpp:(.text+0x1a4): undefined reference to `Common_Update()'
play_stream.cpp:(.text+0x1b0): undefined reference to `Common_BtnPress(Common_Button)'
play_stream.cpp:(.text+0x1c8): undefined reference to `FMOD::ChannelControl::getPaused(bool*)'
play_stream.cpp:(.text+0x1d8): undefined reference to `ERRCHECK(FMOD_RESULT)'
play_stream.cpp:(.text+0x1f3): undefined reference to `FMOD::ChannelControl::setPaused(bool)'
play_stream.cpp:(.text+0x203): undefined reference to `ERRCHECK(FMOD_RESULT)'
play_stream.cpp:(.text+0x20f): undefined reference to `FMOD::System::update()'
play_stream.cpp:(.text+0x21f): undefined reference to `ERRCHECK(FMOD_RESULT)'
play_stream.cpp:(.text+0x259): undefined reference to `FMOD::ChannelControl::isPlaying(bool*)'
play_stream.cpp:(.text+0x277): undefined reference to `ERRCHECK(FMOD_RESULT)'
play_stream.cpp:(.text+0x28b): undefined reference to `FMOD::ChannelControl::getPaused(bool*)'
play_stream.cpp:(.text+0x2a9): undefined reference to `ERRCHECK(FMOD_RESULT)'
play_stream.cpp:(.text+0x2c5): undefined reference to `FMOD::Channel::getPosition(unsigned int*, unsigned int)'
play_stream.cpp:(.text+0x2e3): undefined reference to `ERRCHECK(FMOD_RESULT)'
play_stream.cpp:(.text+0x2ff): undefined reference to `FMOD::Sound::getLength(unsigned int*, unsigned int)'
play_stream.cpp:(.text+0x31d): undefined reference to `ERRCHECK(FMOD_RESULT)'
play_stream.cpp:(.text+0x329): undefined reference to `Common_Draw(char const*, ...)'
play_stream.cpp:(.text+0x335): undefined reference to `Common_Draw(char const*, ...)'
play_stream.cpp:(.text+0x341): undefined reference to `Common_Draw(char const*, ...)'
play_stream.cpp:(.text+0x34d): undefined reference to `Common_Draw(char const*, ...)'
play_stream.cpp:(.text+0x359): undefined reference to `Common_Draw(char const*, ...)'
play_stream.cpp:(.text+0x365): undefined reference to `Common_BtnStr(Common_Button)'
play_stream.cpp:(.text+0x375): undefined reference to `Common_Draw(char const*, ...)'
play_stream.cpp:(.text+0x381): undefined reference to `Common_BtnStr(Common_Button)'
play_stream.cpp:(.text+0x391): undefined reference to `Common_Draw(char const*, ...)'
play_stream.cpp:(.text+0x39d): undefined reference to `Common_Draw(char const*, ...)'
play_stream.cpp:(.text+0x501): undefined reference to `Common_Draw(char const*, ...)'
play_stream.cpp:(.text+0x50d): undefined reference to `Common_Sleep(unsigned int)'
play_stream.cpp:(.text+0x519): undefined reference to `Common_BtnPress(Common_Button)'
play_stream.cpp:(.text+0x530): undefined reference to `FMOD::Sound::release()'
play_stream.cpp:(.text+0x540): undefined reference to `ERRCHECK(FMOD_RESULT)'
play_stream.cpp:(.text+0x54c): undefined reference to `FMOD::System::close()'
play_stream.cpp:(.text+0x55c): undefined reference to `ERRCHECK(FMOD_RESULT)'
play_stream.cpp:(.text+0x568): undefined reference to `FMOD::System::release()'
play_stream.cpp:(.text+0x578): undefined reference to `ERRCHECK(FMOD_RESULT)'
play_stream.cpp:(.text+0x57d): undefined reference to `Common_Close()'
/tmp/ccCYnnTg.o: In function `FMOD::System_Create(FMOD::System**)':
play_stream.cpp:(.text._ZN4FMOD13System_CreateEPPNS_6SystemE[_ZN4FMOD13System_CreateEPPNS_6SystemE]+0xd): undefined reference to `FMOD_System_Create'
/tmp/ccCYnnTg.o:(.eh_frame+0x4b): undefined reference to `__gxx_personality_v0'
collect2: error: ld returned 1 exit status

最佳答案

您可能还需要在项目设置中包含要链接的库。对于 FMOD,您需要链接到

  • libfmod.so
  • libfmodL.so

它们位于 .../api/lowlevel/lib 或 .../api/studio/lib 中,在您下载的包内。

一旦完成,编译器就可以找到您的代码引用的外部符号。

关于c++ - FMOD 播放流示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25142433/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com