Thread: Problem working PlaySound()...

  1. #1
    Not stupid, just stupider yaya's Avatar
    Join Date
    May 2007
    Location
    Earthland
    Posts
    204

    Thumbs up Problem working PlaySound()...

    I'm trying to get sound playing using wxDev-C++ but I'm failing hard. This is my attempt here:

    Code:
    #include <iostream>
    #include <windows.h>
    
    using namespace std;
    
    int main()
    {
        PlaySound("test.wav", NULL, SND_ASYNC | SND_FILENAME);
        cin.get();
        return 0;
    }
    This is the error I get:

    Code:
    [Linker Error] undefined reference to `PlaySoundA@12'
    ld returned 1 exit status
    Am I going about this wrongly? I'm certain the .wav file exists under that filename if you're thinking that.

    Thanks.

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Link against winmm.lib.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 01-18-2008, 04:06 AM
  2. Playsound problem
    By rEtard in forum Windows Programming
    Replies: 13
    Last Post: 02-07-2006, 08:38 AM
  3. small reference problem
    By DavidP in forum C++ Programming
    Replies: 6
    Last Post: 06-21-2004, 07:29 PM
  4. Replies: 5
    Last Post: 12-03-2003, 05:47 PM
  5. inStream practice problem not working?
    By correlcj in forum C++ Programming
    Replies: 2
    Last Post: 10-27-2002, 05:58 PM