Archived

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

arsenius

Issues with PlaySound() and VC++ 6.0 bug

Recommended Posts

I''ve been trying to use PlaySound() in my little basic windows program as per TOTWGPG and Teach yourself DirectX in 24 hours. I''ve copied the code exactly as they have it, and i keep getting a weird linker error (I''d post the error, but for some reason, i haven''t been able to access the forums from home lately, i''ll try again when I get home) I have no idea what i''m doing wrong, i know i''m passing it the right data, I''ve tried using waves from disk and resource, and i get the same error regardless. Also, has anyone else encountered the bug in VC++6.0 (maybe other versions, never used them) where occasionally you type a bit of code, and you get crazy errors, and you just retype over where the code was and it''s fixed, without any actual changes to your code? I''ve had this happen on both my computer, and when I started out, the school''s computers, and my high school teacher had encountered it numerous times. -arsenius ''after three days without programming, life becomes meaningless'' -The Tao of Programming

Share this post


Link to post
Share on other sites
Project->Settings, Link tab, Object/library modules edit box:

Add winmm.lib to the edit box.

Anyway I assume that's why it's not linking. Usually linker errors are due to an inability to locate the proper .dll.

-fel

EDIT: In response to your other question: Often when that happens it's due to the introduction of control characters (either by you hitting ctrl-something accidentally or some happy-helpful-intellisense-thingy screwup on VC's part) which you can't see because they aren't part of the fontset for the default MSVC font. If deleting the line and retyping it works, go with it. *wry smile*


Edited by - felisandria on April 25, 2001 2:05:13 PM

Share this post


Link to post
Share on other sites
ok, now that I know how to get PlaySound() to work, in a more general sense, how would I know in the future what .lib to include? I would have never guessed to include winmm.lib, i was under the impression that it should have been included as standard, TOTWGPG didn''t make any mention of winmm.lib



-arsenius
''after three days without programming, life becomes meaningless'' -The Tao of Programming

Share this post


Link to post
Share on other sites
It''s actually in the MSDN help files. I just happened to know it offhand, but I looked and it was there.

When you start getting into DirectX, you will have to include the DirectX .dll''s you want to use explicitly, like you did for this one, or if you go OpenGL, there are OpenGL .dll''s to us. Generally speaking the .dll''s you want to use are packaged with the header files you''re talking to.

As a side note, if you have the .lib files in any place other than the system directory with all your windows .lib files, you will need to define the .lib directory in Tools->Options, Directories tab, Libraries in the combo box, and browse to where you need to be.

99% of the time, when you get a link error it''s because you''re trying to use a .dll that isn''t there by default.

Just random "stuff to know when using VC".

-fel

Share this post


Link to post
Share on other sites