Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 344
  • Last Modified:

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.
0
chrisrobinson
Asked:
chrisrobinson
  • 3
  • 2
1 Solution
 
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
 
chrisrobinsonAuthor Commented:
Thanks - I wasn’t linking properly!  I am now, in Project Settings, Object/library modules: winmm.lib
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
tma050898Commented:
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
 
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

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now