?
Solved

PlaySound problem

Posted on 1998-05-24
6
Medium Priority
?
338 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 3

Accepted Solution

by:
tma050898 earned 150 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

718 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