views:

204

answers:

2

I'm currently trying to use the latest stable fmod ex in my project.

I have a main executable in a project called engine4, and a project named DX9Platform in the solution as well which ti depends on. All the fmod code is in this DX9Platform project, which generates a lib file.

DX9Platform includes fmodex_vc.lib and builds fine. However building Engien4 results in unresolved external symbol messages referencing files that use fmod in the DX9Platform project

I have tried adding fmodex_vc.lib to the Engine4 project, with no success, how do I fix this?

Heres the linker output:

3>------ Build started: Project: Engine4, Configuration: Release Direct3D9 Win32 ------
3>Linking...
3>DX9PlatformLib.lib(CFmodSound.obj) : error LNK2001: unresolved external symbol _FMOD_System_Create
3>DX9PlatformLib.lib(CFmodSound.obj) : error LNK2001: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::System::createSound(char const *,unsigned int,struct FMOD_CREATESOUNDEXINFO *,class FMOD::Sound * *)" (?createSound@System@FMOD@@QAE?AW4FMOD_RESULT@@PBDIPAUFMOD_CREATESOUNDEXINFO@@PAPAVSound@2@@Z)
3>DX9PlatformLib.lib(CFmodSound.obj) : error LNK2001: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::System::getVersion(unsigned int *)" (?getVersion@System@FMOD@@QAE?AW4FMOD_RESULT@@PAI@Z)
3>DX9PlatformLib.lib(CFmodSound.obj) : error LNK2001: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::System::init(int,unsigned int,void *)" (?init@System@FMOD@@QAE?AW4FMOD_RESULT@@HIPAX@Z)
3>DX9PlatformLib.lib(CFModAudioObject.obj) : error LNK2001: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::System::playSound(enum FMOD_CHANNELINDEX,class FMOD::Sound *,bool,class FMOD::Channel * *)" (?playSound@System@FMOD@@QAE?AW4FMOD_RESULT@@W4FMOD_CHANNELINDEX@@PAVSound@2@_NPAPAVChannel@2@@Z)
3>DX9PlatformLib.lib(CFModAudioObject.obj) : error LNK2001: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::Channel::getPaused(bool *)" (?getPaused@Channel@FMOD@@QAE?AW4FMOD_RESULT@@PA_N@Z)
3>DX9PlatformLib.lib(CFModAudioObject.obj) : error LNK2001: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::Channel::setPaused(bool)" (?setPaused@Channel@FMOD@@QAE?AW4FMOD_RESULT@@_N@Z)
3>DX9PlatformLib.lib(CFModAudioObject.obj) : error LNK2001: unresolved external symbol "public: virtual class IAudioObject * __thiscall CFModAudioObject::LoadFile(char const *)" (?LoadFile@CFModAudioObject@@UAEPAVIAudioObject@@PBD@Z)
3>D:\media\desktop\engine4\Engine4\Output\Release Direct3D9\Engine4.exe : fatal error LNK1120: 8 unresolved externals
3>Build log was saved at "file://d:\media\desktop\engine4\Engine4\Engine4\intermediate\Release Direct3D9\BuildLog.htm"
3>Engine4 - 9 error(s), 0 warning(s)
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========
A: 

The trick here is that using the C++ API will never work because of compiler mismatches, so use the C API wherever possible.

Also be aware that some fmod documentation is out of date. Certain code will 'compile' but will never fully link/work

Tom J Nowell
A: 

I had the same issue with FMOD 4.32.02 64-bit, compiled under VS2005. However, the 32-bit version links and works as expected, so I am currently using that instead.

I actually had the exact same issue when using another library, libsndfile. When I came across it a second time, I ruled out the possibility of the library having been compiled wrong. Apparently, you may get this with any 64-bit library.

Fortunately, all you need to to set a compiler option. I haven't tried it yet, but there is plenty of info out there.

zourtney