Problem working PlaySound()...

This is a discussion on Problem working PlaySound()... within the C++ Programming forums, part of the General Programming Boards category; I'm trying to get sound playing using wxDev-C++ but I'm failing hard. This is my attempt here: Code: #include <iostream> ...

  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をこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,428
    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, 03:06 AM
  2. Playsound problem
    By rEtard in forum Windows Programming
    Replies: 13
    Last Post: 02-07-2006, 07: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, 04:47 PM
  5. inStream practice problem not working?
    By correlcj in forum C++ Programming
    Replies: 2
    Last Post: 10-27-2002, 04:58 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21