0
0

Hi,

I have a problem linking FMOD into my Visual C++ project.

This is what I have done:

created a simple class:

<Snip snip>

ifndef SOUND_H

define SOUND_H

include <stdlib.h>

include “fmod.h”

class SOUND {

public:

FMUSIC_MODULE *mod;

SOUND() {
    mod = NULL;
    if (!FSOUND_Init(12000, 32, FSOUND_INIT_GLOBALFOCUS))
    {
    exit(1);
    }
};


void init() {
    mod = FMUSIC_LoadSong("\\song.wav");
if (!mod)
    {
    exit(1);
    }
};
void play() {
    FMUSIC_PlaySong(mod);
}

};

endif

<snip snip>

When I use this within my main object :

<snip snip>

include “Sound.h”

class MyApp
{

public:
SOUND snd;

…..
…..
}
<snip snip>

It compiles properly, but when it starts to link I get this:

<snip snip>

Linking…
myproject.obj : error LNK2019: unresolved external symbol FMUSIC_LoadSong referenced in function “public: __cdecl MyApp
myproject.obj : error LNK2019: unresolved external symbol FMUSIC_PlaySong referenced in function “public: virtual long __cdecl CMyApplication::ProcessNextFrame(class CGapiSurface &,unsigned long)” (?ProcessNextFrame@CMyApplication@@UAAJAAVCGapiSurfa
ce@@K@Z)
myproject.obj : error LNK2019: unresolved external symbol FSOUND_Init referenced in function “public: __cdecl SOUND::SOUND(void)” (??0SOUND@@QAA@XZ)
ARMRel/MyProject.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.

I have definitely put the fmodvc.lib in the Link configuration, and double checked that it can find it.

Please help.

Joe

  • You must to post comments
0
0

I have just sent an email to you :)

joe

  • You must to post comments
0
0

You’re compiling c++ code and FMOD is pure c. Sp you’ll simply need to tell the compiler to interprete the include file as c code with
[code:xwdts6h2]
extern "c"
{

include <fmod.h>

}
[/code:xwdts6h2]

Hope this helps,
Bjørn.

  • You must to post comments
0
0

I am afraid I still have the problem… :(
joe

  • You must to post comments
0
0

hi,

I have tried putting:

extern “C”
{

include “fmod.h”

}

but I still get the same linking problems…

:(

jomarco

  • You must to post comments
0
0

[quote="Bjoern Graf":3vq2606l]These are just runtime settings and do not affect linking – at least to my knowledge :)[/quote:3vq2606l]

I know, but I have this sort of problems if I dont make that… Do you have trying ?

  • You must to post comments
0
0

Oops, forget my previous reply 😳

Anyway, I pasted your code into the simplest sample project and it links without any problems. Make sure that fmodvc.lib is in ALL configurations in the linker tab and that the path is either in the global lib search path or in the projects settings.

Hope this helps more :)
Bjørn.

  • You must to post comments
0
0

hi,

thank you for the prompt response.

I have double checked my link settings, everything is in place:
ie.
1. Project/Settings/Link/Input/

fmodvc.lib is inplace,
and also the additional library path

I am using GapiDraw 1.04

To be more specific:

I have FMOD_sound.h as follows ( just to test)

<snip snip>

ifndef SOUND_H

define SOUND_H

extern “C”
{

include “fmod.h”

}

typedef class SOUND {

public:

FMUSIC_MODULE *mod;

SOUND() {
    mod = NULL;
    FSOUND_Init(12000, 32, FSOUND_INIT_GLOBALFOCUS);
};

void SOUND::load() {
    mod = FMUSIC_LoadSong("\\Windows\\Start Menu\\Shooter\\Shot.wav");
};
void SOUND::play() {
    FMUSIC_PlaySong(mod);
}

} SOUND;

endif

<snip snip>

In the main application:

<snip snip>

include “GapiDraw.h”

include “GapiDrawApplication.h”

include “FMOD_Sound.h”

class CMyApplication : public CGapiApplication
{

public:
SOUND snd;

CMyApplication(const GDAPPCONFIG&amp; config) : CGapiApplication(config) {
    snd = SOUND();
    snd.load();
    snd.play();     
};


}

<snip snip>

Would this cause any problems?

thanks again for help

Jomarco

  • You must to post comments
0
0

Hello again,

I found that if I add

void test_sound() {
    snd = SOUND();
    snd.load();
    snd.play();
}

into my sample app… it works… it only complains with linking problem inside the CGAPIapplication when it is invoked….

The linker error is:

Linking…
myproject.obj : error LNK2019: unresolved external symbol FMUSIC_PlaySong referenced in function “public: __cdecl CMyApplication::CMyApplication(struct _GDAPPCONFIG const &)” (??0CMyApplication@@QAA@ABU_GDAPPCONFIG@@@Z)
myproject.obj : error LNK2019: unresolved external symbol FMUSIC_LoadSong referenced in function “public: __cdecl CMyApplication::CMyApplication(struct _GDAPPCONFIG const &)” (??0CMyApplication@@QAA@ABU_GDAPPCONFIG@@@Z)
myproject.obj : error LNK2019: unresolved external symbol FSOUND_Init referenced in function “public: __cdecl CMyApplication::CMyApplication(struct _GDAPPCONFIG const &)” (??0CMyApplication@@QAA@ABU_GDAPPCONFIG@@@Z)
ARMRel/MyProject.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
Creating browse info file…

I hope this gives more information as to why it is failing

Jomarco

  • You must to post comments
0
0

You do not code often in c++, do you 😀

First, what version of VC do you have? I don’t see any reason why the link should fail if the SOUND stuff is inside the c’tor…

Next, even thought I don’t have GapiDraw, the code still compiles and links without any errors – even thought I removed the CGapiApplication references :)

One last thing, the line [code:224abca2]snd = SOUND();[/code:224abca2] doen’t initialize the snd object properly, while
[code:224abca2]
CMyApplication(const GDAPPCONFIG& config)
: CGapiApplication(config)
, snd()
{
snd.load();
snd.play();
}
[/code:224abca2]
will do 😉

Bjørn.

PS: Maybe it’s better to continue this via e-mail :)

  • You must to post comments
0
0

do you have add the fmod.dll in your Project Setting ?

  • You must to post comments
0
0

I have only added fmodvc.lib

Do I have to add the dll? for it to link?

My email is joe@worldproximity.com

I have done what you have adviced but still have the problem… :(

Thank you again for all your help..

joe

  • You must to post comments
0
0

You must add the dll here:

“Project\Settings\”

and then, in the new window:

“Debug” -> “Additionnal DLLs” (the listbox of “General”)

then you click on the list under “Local name” and add the fmod.dll

do you understend or i’m a verry bad teacher ? 😳

  • You must to post comments
0
0

These are just runtime settings and do not affect linking – at least to my knowledge :)

  • You must to post comments
Showing 13 results
Your Answer

Please first to submit.