FMOD播放流示例

时间:2014-08-05 15:17:51

标签: c++ fmod

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

此外我收到有关fmod.hpp未找到的错误,因此我将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

2 个答案:

答案 0 :(得分:0)

您可能还需要在项目设置中包含要链接的库。在FMOD的情况下,您需要链接

  • libfmod.so
  • libfmodL.so

位于您下载的软件包中的... / api / lowlevel / lib或... / api / studio / lib中。

完成此操作后,编译器可以找到代码引用的外部符号。

答案 1 :(得分:0)

FMOD API现在为所有api示例提供了makefile。如果使用makefile编译示例,则将避免此错误。 对于存储库和标头的文件夹,他们还使用名称“ core”而不是“ lower_level”。