Solved

PlaySound problem

Posted on 1998-05-24
6
314 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
  • 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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now