Пример плейстрима FMOD

Я хочу воспроизвести файл mp3, поэтому я искал и узнал о FMOD. Я скачал его http://www.fmod.org/download/ (API программиста FMOD Studio для линукс).

Также я получал ошибки о том, что fmod.hpp не найден, поэтому я скопировал все файлы заголовков в папке inc в папку примеров и избавился от них, но теперь я получаю это.

Теперь я попытался скомпилировать пример 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

person user3875963    schedule 05.08.2014    source источник
comment
Вы не связываете правильные библиотеки   -  person BЈовић    schedule 05.08.2014
comment
Читайте здесь: gcc.gnu.org/onlinedocs/gcc/Link-Options.html   -  person BЈовић    schedule 05.08.2014
comment
или это: stackoverflow.com/questions/10749058 /   -  person BЈовић    schedule 05.08.2014
comment
@BЈовић Спасибо, я прочитал их, но я только новичок и до сих пор не понимаю, как мне заставить это работать..   -  person user3875963    schedule 05.08.2014
comment


Ответы (2)


Возможно, вам также потребуется включить в настройки вашего проекта библиотеки, с которыми вы хотите связать. В случае FMOD вам нужно связать с

  • libfmod.so
  • libfmodL.so

которые расположены в .../api/lowlevel/lib или .../api/studio/lib внутри загружаемого вами пакета.

Как только это будет сделано, компилятор сможет найти внешние символы, на которые ссылается ваш код.

person chorch    schedule 01.05.2015

API FMOD теперь предоставляет make-файлы для всех примеров API. Если вы скомпилируете примеры с make-файлом, вы избежите этой ошибки. Они также используют имя «core» вместо «lower_level» для папки, в которой хранятся библиотеки и заголовки.

person Tim    schedule 28.09.2019