cwindowsmingwfmod

Compiling FMOD with mingw?


I have the following example from gamedev, and I was wondering how you would go about compiling it. I've downloaded FMOD and its installed in C:\Program Files\FMOD SoundSystem\FMOD Programmers API Win32. I have the .dlls and an mp3 file in my working directory, but I'm not sure what/how to compile and link this through the command line.

Code:

#include 
#include "inc/fmod.h"

FSOUND_SAMPLE* handle;

int main ()
{
   // init FMOD sound system
   FSOUND_Init (44100, 32, 0);

   // load and play sample
   handle=FSOUND_Sample_Load (0,"sample.mp3",0, 0, 0);
   FSOUND_PlaySound (0,handle);

   // wait until the users hits a key to end the app
   while (!_kbhit())
   {
   }

   // clean up
   FSOUND_Sample_Free (handle);
   FSOUND_Close();
}

Solution

  • That code is for FMOD3, I would recommend getting the latest release of FMODEx aka FMOD4 from www.fmod.org.

    When compiling really don't have to do anything special, just ensure you '-I' include the directory that contains "inc/fmod.h" and '-L' the "lib" directory that contains the fmod lib and lastly '-l' the actual fmod lib.