Jump to content
  • Advertisement
Sign in to follow this  
alexbt

DirectSoudn: Can't open a *.wav file

This topic is 3055 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

According MSDN Help and other tutorials to open a *.wav file I'm using the following code source:

CWaveFile *waveFile = new CWaveFile();

HRESULT hr = waveFile->Open(L"sound1.wav",NULL, WAVEFILE_READ);

if(FAILED(hr))
{
MessageBox(hWnd, "Can NOT open the wave file!","Message",MB_OK);
}




but when I compile above code, I get this errors:

1>main.obj : error LNK2019: unresolved external symbol "public: long __thiscall CWaveFile::Open(wchar_t *,struct tWAVEFORMATEX *,unsigned long)" (?Open@CWaveFile@@QAEJPA_WPAUtWAVEFORMATEX@@K@Z) referenced in function "void __cdecl loadSound(void)" (?loadSound@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall CWaveFile::CWaveFile(void)" (??0CWaveFile@@QAE@XZ) referenced in function "void __cdecl loadSound(void)" (?loadSound@@YAXXZ)

Can anyone help me, what I do wrong?

Share this post


Link to post
Share on other sites
Advertisement
Your project doesn't contain the .cpp file that implements CWaveFile::Open and the CWaveFile constructor. You'll need to add those .cpp files to your project.

Share this post


Link to post
Share on other sites
I have added all the .cpp files which are needed, and after compiling this I got the same error as in this thread: http://www.gamedev.net/community/forums/topic.asp?topic_id=331420

I tried to find solution with google, I found nothing helpful.

[Edited by - alexbt on July 10, 2010 6:00:07 AM]

Share this post


Link to post
Share on other sites
You need to be more specific about what you've done and what errors you're getting. Your post boils down to "Here's 4 lines of code. I added some other files (which you don't describe). I'm getting errors. What's the problem?"

Are you using the DXUT example sound cpp and header files? If so, which ones? Have you copied them to your project and modified them appropriately for your project settings? If so, how did you change them?

Share this post


Link to post
Share on other sites
I have included in my project old DXUTsound.h and DXUTsound.cpp files and all dependences .h and .cpp files.
What I did is I have updated DirectxSDK, then I have included DXUT map to my project, and instead of DXUTsound files I have included SDKwavefile files, in a linker->input->additional dependencies I have added winmm.lib, now everything works fine.

Share this post


Link to post
Share on other sites
If I were you I would work out which of those steps you took solved your problem, cause you listed a lot of things and you're in danger of having this block of code turn into something mysterious that you're afraid to go back and maintain, trust me I've been there.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!