Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7734305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:13:01+00:00 2026-06-01T07:13:01+00:00

EDITED SO THE CODE IS CORRECT (THANKS TO ta.speot.is) – NEW QUESTION AT BOTTOM

  • 0

EDITED SO THE CODE IS CORRECT (THANKS TO ta.speot.is) – NEW QUESTION AT BOTTOM

So I have been playing with the console as I am at that level, and we have been asked to make our first "project" for a assessment. I have the basic application all done.. but i wanted to jaz it up a bit and add some sounds. Sounds that will play from the console.

This test works(kind of), as it will play a sound file, but there are 2 problems…

  1. When the sound starts playing, the application freezes until it finishes playing.

  2. When I try to compile as a "release" it errors with a "linking error" – fatal error LNK1120: 1 unresolved externals.

#include <iostream>
#include <windows.h>
#include <mmsystem.h>
using namespace std;

int main(){
    //PlaySound(TEXT("mywavsound.wav"), NULL, SND_FILENAME); - My erroring code
    PlaySound(TEXT("mywavsound.wav"), NULL, SND_FILENAME | SND_ASYNC);// - the correct code
        
    int test = 0;
    cin>>test;
    return 0;
}

So my questions are…

  1. How can I play sounds without freezing the console, so I can for
    example play looping music file while the project
    is running? Also it would be great if I could play other sounds on top
    of it, for example when you press enter it will plays a sound
    without stopping the music.

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

EDIT

I know about the SND_ASYNC thing but I do not know how to use it, I can’t seem to use it without the thing not compiling.. does anyone have an example of a code using SND_ASYNC?

EDIT 2

So I have this working now…. using the

PlaySound(TEXT("mysound.wav"), NULL, SND_FILENAME | SND_ASYNC);

Now I am wondering how I can get 1 or more sounds to play at once, for if I call PlaySound() twice with that flag it will stop the 1st one and play the 2nd.. Is there a way to play 2 sounds at once?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:13:02+00:00Added an answer on June 1, 2026 at 7:13 am

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: The code below has been edited to show the correct solution to the
I have HTML code edited by FCKEditor stored in a database and would like
SOLVED. Code has been edited to reflect solution. Given the following GridView : <asp:GridView
--edited for clarity (hopefully) I have an XML file that looks something like this:
I edited the question after David Hanak's answer (thanks btw!). He helped with the
I think I have the code correct for storing data in an ArrayList. However,
Edited - I posted an earlier version of my code originally, correct code now
I have an F# exception that it is not being caught in the correct
I have the code below that grabs some html from an AJAX request and
I have the following jQuery code in my PHP file (edited Jan 19 2010

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.