C ++: referência indefinida a 'FMOD :: X'
epois de procurar várias bibliotecas de APIs de som, decidi usar o FMOD por enquant
O problema é que sempre que tento compilar um dos exemplos de código, recebo os seguintes erros:
obj\Release\main.o:main.cpp|| undefined reference to `FMOD::System::getVersion(unsigned int*)@8'|
obj\Release\main.o:main.cpp|| undefined reference to `FMOD::System::init(int, unsigned int, void*)@16'|
obj\Release\main.o:main.cpp|| undefined reference to `FMOD::System::createSound(char const*, unsigned int, FMOD_CREATESOUNDEXINFO*, FMOD::Sound**)@20'|
obj\Release\main.o:main.cpp|| undefined reference to `FMOD::Sound::setMode(unsigned int)@8'|
O exemplo de código que estou usando é o seguinte:
#include <D:\Games\FMOD Programmers API Win32\api\inc\fmod.hpp>
#include <D:\Games\FMOD Programmers API Win32\api\inc\fmod_errors.h>
#include <sstream>
#include <windows.h> // for PlaySound()
#include <time.h>
#include <mmsystem.h>
using namespace std;
int main(int argc, char* argv[])
{
FMOD::System *system;
FMOD::Sound *sound1, *sound2, *sound3;
FMOD::Channel *channel = 0;
FMOD_RESULT result;
int key;
unsigned int version;
/*
Create a System object and initialize.
*/
result = FMOD::System_Create(&system);
result = system->getVersion(&version);
result = system->init(32, FMOD_INIT_NORMAL, 0);
result = system->createSound("../media/drumloop.wav", FMOD_HARDWARE, 0, &sound1);
result = sound1->setMode(FMOD_LOOP_OFF); /* drumloop.wav has embedded loop points which automatically makes looping turn on, */
/* so turn it off here. We could have also just put FMOD_LOOP_OFF in the above CreateSound call. */
// Code continues into other bits that work...
Estou usando a versão mais recente do FMOD e o IDE Code :: Blocks (versão 10.05), com o compilador GNU GCC. O projeto é do tipo "Aplicativo de console". O arquivo fmodex.dll está na pasta do meu projeto. Estou usando o Windows XP SP3 de 32 bits.
Vinculei aolibfmodex.a
e tentei vincular-se a outras bibliotecas, mas isso não resolve o problem
Minha pergunta é, portanto, o que preciso fazer para impedir a ocorrência desses erros? Como quando eu encontrei erros "Referência indefinida x" semelhantes antes de usar outras bibliotecas. Esqueci-me de vincular a eles no Code :: Blocks e, assim que o fiz, eles funcionaria
Diga se você precisar de mais informações sobre o código etc.