I get this linker error: error LNK2019: 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) referenced in function "public: void __thiscall rsblsb::Sound::play(void)" (?play@Sound@rsblsb@@QAEXXZ)

if I call system->playSound() from one file. If I call the exact same function from another file, it links correctly and the sound plays no problem.

I’m linking fmodex_vc.lib. I tested in 3 different configurations, and it’s always the same. Both files have .cc extension, both call the playSound function from inside a class member function, both classes are defined in the same namespace.

Any idea how this is even possible?

  • You must to post comments


  • Clean from inside visual studio. Then quit visual studio and physically delete any intermediate directories, the ncb file, and any other intermediate/auxiliary files. Then open the project and REbuild it. This is mostly just voodoo, and you’ve probably already done it, but I swear it’s helped me sometimes.

  • The broken file is somehow including a "bad" header that the other files aren’t.

  • The broken file has bad compile/link settings just for it (e.g. someone changed the build options just for that file, pragmas, rules).

  • If rsblsb::Sound::play is inline (i.e. defined in a header file), make it a normal non-inline method.

  • If you’re linking to other libraries that you’ve built, try rebuilding those too.

  • Compare the mangled signature for FMOD::System::playSound shown in the link error with the mangled signature for the one that links correctly (it should appear somewhere in the .map file if you enable map file generation). If there are multiple versions of the function, you should be able to tell what the difference is by the mangled signature. With GCC you can use the "c++filt" program to decode the mangled names into readable declarations. I’m not sure if there’s a vc equivalent. I’m sure MSDN at least has a dictionary for decoding them by hand. This won’t fix your problem but it should give you an idea where the problem is.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.