Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Idhrendur

Linker Error/Where did PlaySound() go?

This topic is 5241 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was doing some research on MSDN on the windows API for sound, and I found the function PlaySound(). It seemed exactly what I needed, so I put it in my code. I confirmed the only include I needed was windos.h, then went to compile my code. So what should happen, but I get the linker error game.obj : error LNK2001: unresolved external symbol __imp__PlaySoundA@12 Why can''t the linker find PlaySound. It should be there when I include windows.h. When I typed it in, VC++ (6.0) even showed me the parameters I needed, like it does whenever I''ve got things right. Just in case, here''s the function that uses PlaySound():
void play_sound(sound choice) {
	switch (choice) {
		case blocked:
			PlaySound("blocked.wav", NULL, SND_ASYNC | SND_FILENAME);
			break;
		case landed:
			break;
		case cleared:
			break;
	}
}

Share this post


Link to post
Share on other sites
Advertisement
OK, you need two things.
First #include <mmsystem.h>
Second, link winmm.lib in your project.

Google is your friend.

[edit] Oh, and just because you can get all the info on the function in the IDE does not mean you have the proper libs/headers included. Sucks don't it?

You might also want to look at msdn

[edited by - jflanglois on May 19, 2004 2:22:50 AM]

Share this post


Link to post
Share on other sites
Thank you. It worked just fine.

I guess I didn''t understand the line in MSDN that said:
Library: Use Winmm.lib.

Ah well, this is how you learn.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!