PlaySound problem

1. I have MS Developer Studio 97 with VC++ V5.0 running under Windows 95.

2. I am trying to use:

   PlaySound("train.wav", NULL, SND_FILENAME);

with #include <mmsystem.h> & winmm.lib in place.

3. I get the error msg:

Linking...
DirectSound1View.obj : error LNK2001: unresolved external symbol __imp__PlaySoundA
Debug/DirectSound1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
chrisrobinsonAsked:
Who is Participating?
 
tma050898Connect With a Mentor Commented:
chrisrobinson,

You can also right-click on the project, select Add Files to Project and select the .lib

IMPORTANT: If you are going to do it via the Project settings (link tab), make sure that in the "Settings For" combo box, you select "All Configurations". By default, it will be set to "Win32 Debug", which means that when you do a release build, you will get the same error again!

Tom

0
 
tma050898Commented:
How are you linking to the winmm.lib file. IOW, how did you add it to your project?
0
 
eric_mCommented:
__imp__PlaySoundA is in the library winmm.lib.  It appears you aren't linking to it.

Are you generating a build log file (.plg)?  From Tools | Options | Build, check "write build file" and then after attempting the build, look at it.  Is there a line similar to this?

Creating command line "link.exe winmm.lib [other options deleted]"


0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
chrisrobinsonAuthor Commented:
Thanks - I wasn’t linking properly!  I am now, in Project Settings, Object/library modules: winmm.lib
0
 
chrisrobinsonAuthor Commented:
Thanks very much.
0
 
tma050898Commented:
Chris,

No problem. BTW, I've got all kinds of wave file code if you run into problems just email me at tma-ng@mindspring.com

Take care,
Tom

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.