   Quick Question (C++)
  I'm trying to clean up my code a bit here, and put my BreakOut clone into classes. Before I just used nasty ugly code.. And now I want to refine it a bit, as practice. Anyways, I've ran into a bit of a snag, and google didn't lead me to anywhere useful.. Hence, I'm here! I'm using DirectX, and I'm trying to get my sound class in order. For the most part, everything went well, until I got to my LoadSound function.. Here's what I have down below://header fileclass sound{public://function prototypesint Init_DirectSound(HWND);CSound * LoadSound(char *); // problem child!void PlaySound(CSound *);void LoopSound(CSound *);void StopSound(CSound *);bool audioNull();void soundRelease();private://sound managerCSoundManager *audio;//resultHRESULT result;};//cpp file - problem child functionCSound * sound::LoadSound(char *filename){//create our local sound file, that will be returned to the callerCSound *wave;//load the waveresult = audio->Create(&wave, filename);if(result != DS_OK)return NULL;//successful load = return 1!return wave;}Now I've used this exact same function before, without any problems.. Now I try it, and I receive 7 or 8 LNK errors. Of course, before I wasn't trying to use classes or anything, and now I am. I assume there's something wrong with the line: CSound * sound::LoadSound(char *filename) but I can't figure out what. I know it's something simple.. Which is why it annoys me that I can't figure it out :P   
  I'm not entirely sure I'm reading it right, but first, your returning a local pointer (*wave).  Thats not good.  Second, I don't know what Creat() does, but make sure your using the *wave pointer correctly.I'm not to sure about your errors though, what exactly are they?   ;  Can you give us the link errors? Possible causes:- You did not link to dsound.lib- You have the definition of LoadSound in your header file- Something elseQuote:Original post by MikeTacularI'm not entirely sure I'm reading it right, but first, your returning a local pointer (*wave).That's should not be a problem. He's not returning the pointer by reference and I assume the object pointed to is not going out of scope.jfl.   ;  I have dsound.lib included properly.. Here's the link errors:sound.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 sound::Init_DirectSound(struct HWND__ *)" (?Init_DirectSound@sound@@QAEHPAUHWND__@@@Z)sound.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 sound::Init_DirectSound(struct HWND__ *)" (?Init_DirectSound@sound@@QAEHPAUHWND__@@@Z)sound.obj : error LNK2019: unresolved external symbol "public: __thiscall CSoundManager::CSoundManager(void)" (??0CSoundManager@@QAE@XZ) referenced in function "public: int __thiscall sound::Init_DirectSound(struct HWND__ *)" (?Init_DirectSound@sound@@QAEHPAUHWND__@@@Z)sound.obj : error LNK2019: unresolved external symbol "public: long __thiscall CSoundManager::Create(class CSound * *,char *,unsigned long,struct _GUID,unsigned long)" (?Create@CSoundManager@@QAEJPAPAVCSound@@PADKU_GUID@@K@Z) referenced in function "public: class CSound * __thiscall sound::LoadSound(char *)" (?LoadSound@sound@@QAEPAVCSound@@PAD@Z)sound.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 sound::PlaySoundA(class CSound *)" (?PlaySoundA@sound@@QAEXPAVCSound@@@Z)sound.obj : error LNK2019: unresolved external symbol "public: long __thiscall CSound::Stop(void)" (?Stop@CSound@@QAEJXZ) referenced in function "public: void __thiscall sound::StopSound(class CSound *)" (?StopSound@sound@@QAEXPAVCSound@@@Z)   ;  [edit] Actually, before you do that, have you included SDKsound.cpp in your project (I assume you're using the DXUT framework) or compiled the DXUT projects and linked to the resulting libs?May we have the code for sound.h/sound.cpp?   ;Quote:Original post by jflangloisThat's should not be a problem. He's not returning the pointer by reference and I assume the object pointed to is not going out of scope.Ah, yes.  Good point.   ;  Im not sure what the CSoundManager object is, but it looks like you didnt link it to your project. It could be a lib file or a cpp file that has to be "added" to your project. Same with CSound...Since you are making classes of code that was working, I assume that you are placing this code in different files as well. If thats the case, I assume that you wrote the CSound.cpp and CSoundManager.cpp files yourself. These files must be added to your project.In VC++ 2005 express, this can be done by right clicking the sources folder in the solution explorer and choose Add -> Existing Item...