I am trying to add a sound library to a GLFW / OpenGL project in windows. I have set the sound project to output a static library (.lib). It compiles fine.
In my main project, I add a reference to Sound and a dependency on Sound (to change the build order). I include "..\Sound\sound.h" in my main.cpp and Intellisense is happy with everything. All compiles well. However, the linker is pissed:
1>Link:
1> LINK : ###\Projects\DeathRace\Debug\DeathRace.exe not found or not built by the last incremental link; performing full link
1>Sound.lib(sound.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in base_objects.obj
1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alListenerfv referenced in function "public: bool __thiscall SoundAPI::Startup(void)" (?Startup@SoundAPI@@QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alListener3f referenced in function "public: bool __thiscall SoundAPI::Startup(void)" (?Startup@SoundAPI@@QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alGetError referenced in function "public: bool __thiscall SoundAPI::Startup(void)" (?Startup@SoundAPI@@QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alutGetError referenced in function "public: bool __thiscall SoundAPI::Startup(void)" (?Startup@SoundAPI@@QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alutInit referenced in function "public: bool __thiscall SoundAPI::Startup(void)" (?Startup@SoundAPI@@QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alutExit referenced in function "public: bool __thiscall SoundAPI::Shutdown(void)" (?Shutdown@SoundAPI@@QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alDeleteBuffers referenced in function "public: bool __thiscall SoundAPI::Shutdown(void)" (?Shutdown@SoundAPI@@QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alDeleteSources referenced in function "public: bool __thiscall SoundAPI::Shutdown(void)" (?Shutdown@SoundAPI@@QAE_NXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alutCreateBufferFromFile referenced in function "public: unsigned int * __thiscall SoundAPI::LoadSound(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?LoadSound@SoundAPI@@QAEPAIV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSourcei referenced in function "public: unsigned int * __thiscall SoundAPI::CreateSource(void)" (?CreateSource@SoundAPI@@QAEPAIXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSource3f referenced in function "public: unsigned int * __thiscall SoundAPI::CreateSource(void)" (?CreateSource@SoundAPI@@QAEPAIXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSourcef referenced in function "public: unsigned int * __thiscall SoundAPI::CreateSource(void)" (?CreateSource@SoundAPI@@QAEPAIXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alGenSources referenced in function "public: unsigned int * __thiscall SoundAPI::CreateSource(void)" (?CreateSource@SoundAPI@@QAEPAIXZ)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSourceQueueBuffers referenced in function "public: bool __thiscall SoundAPI::Queue(unsigned int *,unsigned int *)" (?Queue@SoundAPI@@QAE_NPAI0@Z)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSourcePlay referenced in function "public: bool __thiscall SoundAPI::Play(unsigned int *)" (?Play@SoundAPI@@QAE_NPAI@Z)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSourcePause referenced in function "public: bool __thiscall SoundAPI::Pause(unsigned int *)" (?Pause@SoundAPI@@QAE_NPAI@Z)
1>Sound.lib(sound.obj) : error LNK2019: unresolved external symbol __imp__alSourceStop referenced in function "public: bool __thiscall SoundAPI::Stop(unsigned int *)" (?Stop@SoundAPI@@QAE_NPAI@Z)
1>###\Projects\DeathRace\Debug\DeathRace.exe : fatal error LNK1120: 17 unresolved externals
I have NO IDEA what to make of this. Lnk2038 is supposed to mean a problem between debug and release, but everything is in debug mode. The lnk2019 should be fine against Sound.lib?
Much obliged!