PlaySound in C++ Console application?

How can I play sounds without freezing the console?

If you Google for PlaySound this is the first result:

fdwSound

SND_ASYNC The sound is played asynchronously and PlaySound returns immediately after beginning the sound. To terminate an asynchronously played waveform sound, call PlaySound with pszSound set to NULL.

You should familiarise yourself with search engines and what they are capable of.

How do I add the wav file so it compiles as a release?

You need to link winmm.lib in both Release and Debug configurations. Alternatively, add

#pragma comment(lib, "winmm.lib")

to the top of your source code.

Leave a Comment