Solved

PlaySound problem

Posted on 1998-05-24
6
331 Views
Last Modified: 2010-04-10
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
Comment
Question by:chrisrobinson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:tma050898
ID: 1164652
How are you linking to the winmm.lib file. IOW, how did you add it to your project?
0
 

Expert Comment

by:eric_m
ID: 1164653
__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
 

Author Comment

by:chrisrobinson
ID: 1164654
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!

 
LVL 3

Accepted Solution

by:
tma050898 earned 50 total points
ID: 1164655
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
 

Author Comment

by:chrisrobinson
ID: 1164656
Thanks very much.
0
 
LVL 3

Expert Comment

by:tma050898
ID: 1164657
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question