(C++) How to play Sound (Code::Blocks)

Make sure you #include Windows.h, before you #include MMSystem.h.
In linker I added “winmm”.
PlaySound(TEXT(“yourMusicFile.wav”), NULL, SND_SYNC);

All music in this video is covered under the “Creative Commons 0” License.
http://bit.ly/1eE5NB9

I know people are still going to want to know what the song is, so here.
http://bit.ly/1RVVgpy

Comments

Christian Gewert says:

When you include Windows.h it is NOT necessary to include MMSystem.h also! The API Documentation clearly says :
Header: Mmsystem.h (include Windows.h). Your program should work fine if you simply dismiss including MMSystem.h

Saahil R says:

what should i add in linker settings if I’m using ubuntu? please reply rn

RoBeX says:

I did everything you did but when i press build and run it just plays the standard windows sound (beep :) ) and not the “Sound.wav”.

Quemu says:

GOD!@

Animesh Timsina says:

How to play music in background? so that music plays while the rest of the codes are being processed…….

Gerg Fluton says:

thanks man I sold this to some retard kid for $30

Gerg Fluton says:

thanks man I sold this to some retard kid for $30

LLukik says:

1. Udefined reference to PlaySoundA@12
2. ld returned 1 exit status
help 😀

Oğuz Atay says:

i couldnt see the codes. they are small as hell

Keith Bacalso says:

Pls tell me the steps on how to do it the video is so small in text I couldn’t see properly the codes or what you were clicking :(

Yilmer Tapias says:

buen video :) thanks man XD

loukmane mohammed says:

man, you are genius !!!

Thijo CD says:

Finally something that works! Thanks man 😛

Arkadiusz Bryłkowski says:

U’RE THE BEST MEN! 😀 Always wanted to put Super Mario Bros sountrack xD

Blackscreen Music says:

I have rly cool C melody in my channel!

Blake Hampton says:

I am using VM ware that runs a Linux emulator. I am using coding blocks on this emulator for school. Will this still work?

Write a comment

*

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles▷ Show Cars▷ Motorbikes▷ Scooters▷ Bicycles▷ Rims & Tires▷ Luxury BoatsFashion▷ Sunglasses▷ Luxury Watches▷ Luxury Purses▷ Jeans Wear▷ High Heels▷ Kinis Swimwear▷ Perfumes▷ Jewellery▷ Cosmetics▷ Shaving Helpers▷ Fashion HatsFooding▷ Chef Club▷ Fooding Helpers▷ Coktails & LiquorsSports▷ Sport Shoes▷ Fitness & Detox▷ Golf Gear▷ Racquets▷ Hiking & Trek Gear▷ Diving Equipment▷ Ski Gear▷ Snowboards▷ Surf Boards▷ Rollers & SkatesEntertainment▷ DIY Guides▷ Zik Instruments▷ Published Books▷ Music Albums▷ Cine Movies▷ Trading Helpers▷ Make Money▷ Fishing Equipment▷ Paintball Supplies▷ Trading Card Games▷ Telescopes▷ Knives▷ VapesHigh Tech▷ Flat Screens▷ Tech Devices▷ Camera Lenses▷ Audio HiFi▷ Printers▷ USB Devices▷ PC Hardware▷ Network Gear▷ Cloud Servers▷ Software Helpers▷ Programmer Helpers▷ Mobile Apps▷ Hearing AidsHome▷ Home Furniture▷ Home Appliances▷ Tools Workshop▷ Beddings▷ Floor Layings▷ Barbecues▷ Aquarium Gear▷ Safe Boxes▷ Office Supplies▷ Security Locks▷ Cleaning ProductsKids▷ Baby Strollers▷ Child Car Seats▷ Remote ControlledTravel▷ Luggages & Bags▷ Airlines Seats▷ Hotel Rooms▷ Fun Trips▷ Cruise Ships▷ Mexico Tours