Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FMOD Compiling trouble

Tags:

c++

fmod

I'm trying to get started with FMOD but I'm having some issues compiling the example code in this tutorial:

http://www.gamedev.net/reference/articles/article2098.asp

I'm using MinGW, I placed the libfmodex.a file in MinGW's include folder (I also tried linking directly to the filename) but it doesn't work. Here's the output.

C:\>g++ -o test1.exe test1.cpp -lfmodex
test1.cpp:4:1: error: 'FSOUND_SAMPLE' does not name a type
test1.cpp: In function 'int main()':
test1.cpp:9:29: error: 'FSOUND_Init' was not declared in this scope
test1.cpp:12:4: error: 'handle' was not declared in this scope
test1.cpp:12:53: error: 'FSOUND_Sample_Load' was not declared in this scope
test1.cpp:13:30: error: 'FSOUND_PlaySound' was not declared in this scope
test1.cpp:21:30: error: 'FSOUND_Sample_Free' was not declared in this scope
test1.cpp:22:17: error: 'FSOUND_Close' was not declared in this scope

This is the particular example I'm using:

#include <conio.h>
#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();
}

I have the header files in the "inc" path where my code is. Any ideas as to what I'm doing wrong?

like image 645
CptAJ Avatar asked Apr 29 '26 20:04

CptAJ


2 Answers

That is an old tutorial, the FMOD API has changed since then.

For example, instead of FSOUND_SAMPLE, it is now FMOD::Sound (I think).

Have a look inside your fmod.h and you can see what classes and functions you should be using.

like image 151
Peter Alexander Avatar answered May 02 '26 10:05

Peter Alexander


The gamedev article is old and obsiously uses an old version of the library. See the examples directory of the FMOD Programmers API.

like image 43
hmuelner Avatar answered May 02 '26 11:05

hmuelner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!