Original Post
Hi, I have got these errors on my DirectX 9 program. Please could someone help fix them. I want my program is initialize DirectSound so my game can play audio files and music. error LNK2001: unresolved external symbol "struct HWND__ * hWnd" (?hWnd@@3PAUHWND__@@A) error LNK2019: unresolved external symbol _DirectSoundCreate@12 referenced in function "bool __cdecl Sound_Init(void)" (?Sound_Init@@YA_NXZ) fatal error LNK1120: 2 unresolved externals -- Snippet for DirectSound -- #include <dsound.h> extern HWND hWnd; static LPDIRECTSOUND lpDS; bool Sound_Init(void) { if (DS_OK==DirectSoundCreate(NULL,&lpDS,NULL)) //create direct sound object { //ok, DirectSound Object created, let's take control now... if (DS_OK==IDirectSound_SetCooperativeLevel(lpDS, hWnd, DSSCL_EXCLUSIVE)) { //MessageBox(hMainWnd,"Cooperative Level Succefully Set!","Good!!",MB_OK); return TRUE; } else //SetCoop was unsuccessful, let's give up control { IDirectSound_Release(lpDS); MessageBox(hWnd,L"Set Cooperative Level didn't Work!",L"BAD!!",MB_OK); return FALSE; } } else //DSObj creation was unsuccessful { MessageBox(hWnd,L"Could Not Create Direct Sound Object",L"Error!",MB_OK); return (FALSE); } } /*here's a simple function to shut down direct sound when you're done with it */ void Sound_Exit(void) { if (lpDS) { IDirectSound_Release(lpDS); } else { MessageBox(hWnd,L"Sound was not initialized and cannot Exit!", L"Error!",MB_OK); } }