I am trying to use FMOD library in a console application Visual c++ project....
But I can't really get it to work

I will tell u exactly what i did...

First, I added the following files to the project folder: fmod.h , fmod.dll, fmod_errors.h , fmoddyn.h , fmodvc.lib , wincompat.h

And also in external dependencies, I added fmodvc.lib....

Then, in my C++ source file i wrote #include "fmod.h"

(and I tried also to include the other header files)

I have found many tutorials and they all state that we have to start with the following two lines

handle=FMUSIC_LoadSong("SongName");
	FMUSIC_PlaySong(handle);

but an error shows up saying that "handle" is undeclared.... I tried to declare it myself,the error goes away, but this doesnt work too... and all other functions depend on handle, did I forget something??? And of course I put the sound file inside the project folder and wrote its name correctly as a parameter....

Please help me with that ...
and note that the reason for not using the library linking thing is that i will send the project to other people who don't have FMOD :D

Thanks in advance !!!!

You forgot to call FSOUND_Init() perhaps?

I forgot to say that i added this at the beginning too

FSOUND_Init (44100, 32, 0);

What do u think can be the problem??

Better to post your full code so we can analyze it completely.

#include "fmod.h"
#include "fmod_errors.h"
//#include "fmoddyn.h"
#include "wincompat.h"

void main()
{

	 
	FSOUND_Init (44100, 32, 0);

		FMUSIC_MODULE* handle=FMUSIC_LoadSong("Chiquitita.mp3");
		FMUSIC_PlaySong(handle);

}

// the commeneted "include" caused an error

and the tutorials stated that we only include fmod.h
but i tried the others too

Erm.. from what I can see there are tons of examples: C:\Program Files (x86)\FMOD SoundSystem\FMOD Programmers API Win32\examples Does your code do the same as the examples?

I don't understand you... what do u mean do the same as the examples ????

Try and compile such an example. If it compiles, see what's the difference in source code. Also look at included libraries.

I'd suggest that you check the return values of the FMOD function calls, and use the FSOUND_GetError() to figure out an error, i.e.

int main() //<- main() returns an int
{
    if( ! FSOUND_Init (44100, 32, 0))
    {
        // initialization failed ... what is the error code?
        const int errorCode = FSOUND_GetError();

        return errorCode;
    }

    FMUSIC_MODULE* handle=FMUSIC_LoadSong("Chiquitita.mp3");

    if(handle == NULL)
    {
        // Load failed ... what is the error code ...
        ...
    }        

    ...

    return 0;
}

See the FMOD documentation for the details on each function you use, so you'll learn how to use them properly.

Nothing is printed

Nothing is printed

Assuming you have changed your code, you could post the complete current code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.