Original Post
I'm still having the damn linker errors when i try to compile with sound. It says that: even though i included the .h files from the DXUT library it still doesn't seem to work. also also here is my code for sound. hopefully you can tell me WTF i'm suppose to do to get the linker errors to stop.
1>CSound.obj : error LNK2019: unresolved external symbol "public: long __thiscall CSoundManager::SetPrimaryBufferFormat(unsigned long,unsigned long,unsigned long)" (?SetPrimaryBufferFormat@CSoundManager@@QAEJKKK@Z) referenced in function "public: int __thiscall CSound_Audio::Initialize_DirectAudio(struct HWND__ *)" (?Initialize_DirectAudio@CSound_Audio@@QAEHPAUHWND__@@@Z)
1>CSound.obj : error LNK2019: unresolved external symbol "public: long __thiscall CSoundManager::Initialize(struct HWND__ *,unsigned long)" (?Initialize@CSoundManager@@QAEJPAUHWND__@@K@Z) referenced in function "public: int __thiscall CSound_Audio::Initialize_DirectAudio(struct HWND__ *)" (?Initialize_DirectAudio@CSound_Audio@@QAEHPAUHWND__@@@Z)
1>CSound.obj : error LNK2019: unresolved external symbol "public: __thiscall CSoundManager::CSoundManager(void)" (??0CSoundManager@@QAE@XZ) referenced in function "public: int __thiscall CSound_Audio::Initialize_DirectAudio(struct HWND__ *)" (?Initialize_DirectAudio@CSound_Audio@@QAEHPAUHWND__@@@Z)
1>CSound.obj : error LNK2019: unresolved external symbol "public: long __thiscall CSoundManager::Create(class CSound * *,wchar_t *,unsigned long,struct _GUID,unsigned long)" (?Create@CSoundManager@@QAEJPAPAVCSound@@PA_WKU_GUID@@K@Z) referenced in function "public: class CSound * __thiscall CSound_Audio::LoadSound(wchar_t *)" (?LoadSound@CSound_Audio@@QAEPAVCSound@@PA_W@Z)
1>CSound.obj : error LNK2019: unresolved external symbol "public: long __thiscall CSound::Play(unsigned long,unsigned long,long,long,long)" (?Play@CSound@@QAEJKKJJJ@Z) referenced in function "public: void __thiscall CSound_Audio::PlaySoundW(class CSound *)" (?PlaySoundW@CSound_Audio@@QAEXPAVCSound@@@Z)
1>CSound.obj : error LNK2019: unresolved external symbol "public: long __thiscall CSound::Stop(void)" (?Stop@CSound@@QAEJXZ) referenced in function "public: void __thiscall CSound_Audio::StopSound(class CSound *)" (?StopSound@CSound_Audio@@QAEXPAVCSound@@@Z)
1>C:\Users\DirectX\Documents\Visual Studio 2005\Projects\DirectX 10\Debug\DirectX 10.exe : fatal error LNK1120: 6 unresolved externals
1>Build log was saved at "file://c:\Users\DirectX\Documents\Visual Studio 2005\Projects\DirectX 10\DirectX 10\Debug\BuildLog.htm"
1>DirectX 10 - 7 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========
//////////////////////////////////////////////////////////////////
// //
// Filename: //
// CSound.cpp //
// //
// Purpose: //
// This is were we initialize our class we created earlier //
// int CSound.h. This fill is the "heart" of sound playing //
// //
// Date: //
// November 26th, 2007 //
// //
// Author: //
// Rosario Corsini //
// //
//////////////////////////////////////////////////////////////////
#pragma warning(disable:4267)
#pragma warning(disable:4312)
#pragma warning(disable:4018)
#pragma warning(disable:4244)
#include "CSound.h"
int CSound_Audio::Initialize_DirectAudio(HWND hwnd)
{
g_pSoundManager = new CSoundManager();
HRESULT result;
//Initialize DirectSound
result = g_pSoundManager->Initialize(hwnd, DSSCL_PRIORITY);
if(result != DS_OK)
return 0;
result = g_pSoundManager->SetPrimaryBufferFormat(2,22050,16);
if(result != DS_OK)
return 0;
return 1;
}
CSound* CSound_Audio::LoadSound(wchar_t *filename)
{
HRESULT result;
result = g_pSoundManager->Create(&sound,filename);
if(result != DS_OK)
return 0;
return sound;
}
void CSound_Audio::PlaySoundW(CSound* sound)
{
sound->Play();
}
void CSound_Audio::LoopSound(CSound *sound)
{
sound->Play(0,DSBPLAY_LOOPING);
}
void CSound_Audio::StopSound(CSound *sound)
{
sound->Stop();
}
.CPP
////////////////////////////////////////////////////////////
// //
// Filename: //
// CSound.h //
// //
// Purpose: //
// This file is used to create a class to be able //
// to load sounds, play them, add echo to them, ect. //
// //
// Date: //
// November 26th, 2007 //
// //
// Author: //
// Rosario Corsini //
// //
////////////////////////////////////////////////////////////
//set everything in an #if block
#ifndef CSOUND_H
#define CSOUND_H
#include <SDKsound.h>
#include <SDKwavefile.h>
//#include <nf.h>
//#include <dsound.h>
#pragma comment(lib,"dsound.lib")
//-----------------------------------------------//
// //
// Name: //
// CSound_Audio //
// //
// Purpose: //
// Class to make loading sounds easier //
// //
//-----------------------------------------------//
class CSound_Audio
{
public:
int Initialize_DirectAudio(HWND hwnd);
// int CreateWave(char filename);
CSound* LoadSound(wchar_t *filename);
void PlaySound(CSound* sound);
void LoopSound(CSound* sound);
void StopSound(CSound* sound);
private:
CSoundManager* g_pSoundManager;
CSound* sound;
//LPDIRECTSOUND8 g_pDirectSound; //Direct Sound's primary interface
//LPDIRECTSOUNDBUFFER g_pDirectSoundBuffer; //Creates a sound buffer
//DSBUFFERDESC g_pDirectSoundPrimaryBuffer; //Gets the primary sound buffer
//WAVEFORMATEX g_pWaveFormat; //The wave format used
};
#endif