I cannot run the source code for lesson 21

Started by
7 comments, last by GameDev.net 19 years, 4 months ago
what should i do to run the source code for lesson 21.. I used visual C++ to compile the code.. but they are two errors come out. Lesson21.obj : error LNK2001: unresolved external symbol __imp__timeGetTime@0 Lesson21.obj : error LNK2001: unresolved external symbol __imp__PlaySoundA@12 I already added the "glu32.lib opengl32.lib glaux.lib" in the project-->setting-->LInk... but i still cannot run the source code.. Can anyone help me.. thanks
Advertisement
As far as I remember, you need to add "Winmm.lib".

Hope it helps!
___Quote:Know where basis goes, know where rest goes.
thanks a lot...it works.. Yeahh
you are the man....
where did you get the information about winmm.lib... i also want to know...
Quote:Original post by da_grat1
thanks a lot


You're welcome. :)

quote]
where did you get the information about winmm.lib... i also want to know...

If you write for Windows, MSDN is the best place you can search for answers.

See ya'
___Quote:Know where basis goes, know where rest goes.
I know this doesn't concern your post, but tutorials #21 is the place where sound is used. It does work in my games, but is there a flag I can set in PlaySound() so that more than one sound can play at a time?
Thanks for this great forum
No, for that you'll have to use a different API like SDL, OpenAL or DirectSound... (I prefer OpenAL since it's kinda like OpenGL)
Killers don't end up in jailThey end up on a high-score!
Thanks alot, for the help, I guess it won't be too hard to learn OpenAL.
OpenAL I believe to be easier than DirectSound, plus it is like OpenGL. You can use 2d or 3d sound effects which are quite easy to create. Sounds are positioned kind of like translating an object in OpenGL, a simple one-liner. The listener position is the same way, and velocities can also be programmed the same way. Windows API for multimedia kind of blows for games, but works well for simpler apps, in other words, use OpenAL.


Quote:Original post by nife
No, for that you'll have to use a different API like SDL, OpenAL or DirectSound... (I prefer OpenAL since it's kinda like OpenGL)


Actually, there's a trick that you can use to play multiple sounds with that function... Just spawn a thread that calls PlaySound for every aditional sound. It's a cheap hack, but should work (I haven't tested).

Example:

PlaySound(blabla1);
PlaySound(blabla2);

That will only play the second because it intrrupts the first

Instead have something like this:

int tPlaySound(char *filename)
{
PlaySound(filename);
return 0;
}

CreateThread(..., (void *)tPlaySound, (char *)"blabla1", ...);
CreateThread(..., (void *)tPlaySound, (char *)"blabla2", ...);


that'll play both, or at least should.

This topic is closed to new replies.

Advertisement