Trying to use PlaySound

This is a discussion on Trying to use PlaySound within the C++ Programming forums, part of the General Programming Boards category; I am trying to use the Play Sound function , but I am getting this error : unresolved external symbol ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    25

    Trying to use PlaySound

    I am trying to use the Play Sound function , but I am getting this error : unresolved external symbol __imp__PlaySoundA@12 referenced in function _main
    I am nto sure what to do with this. I am using .Net C++

    Van

  2. #2
    Registered User foniks munkee's Avatar
    Join Date
    Nov 2001
    Posts
    343
    You need to ensure that you have linked the library winmm.lib and included the header mmsystem.h.
    "Queen and huntress, chaste and fair,
    Now the sun is laid to sleep,
    Seated in thy silver chair,
    State in wonted manner keep."

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    25
    I have included mmsystem.h but how do I link the .lib file. I can't figure that part out. I am using MS Visual Studio .NET

    Van

  4. #4
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    You could try
    Code:
     #pragma comment(lib,"winmm.lib")
    Works with MSVC++ 6.0, dont know about .NET

  5. #5
    Registered User alex6852's Avatar
    Join Date
    Sep 2001
    Posts
    43
    Go to "Project" menu and select "Settings"( or press ALT+F7). Then select "Link" tab and write your lib thing in "object/library modules" edit-box.
    That's it
    C++ rulez!!!

  6. #6
    Registered User
    Join Date
    Jan 2002
    Posts
    25
    I don't have a selection for Settings under Project. I have Add Class, Add Resource, Add New Item, Add Existing Item, New Folder and something else. Maybe it is different in MSVS .Net, I will look some more.

    Van

  7. #7
    Registered User
    Join Date
    Jan 2002
    Posts
    25
    Travis Dane, the pragma comment worked. Thanks Can you explain what pragma is?

    Van

  8. #8
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    Well, its something that asures compatibility with other c++
    IDE's,so that link settings can be done from the source and
    not from a menu in the IDE wich another IDE has different.

    (i think )

  9. #9
    Registered User
    Join Date
    Sep 2002
    Posts
    417

    Wink

    I'll have to mess around with this now

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. PlaySound doesn't play when called!
    By Queatrix in forum Windows Programming
    Replies: 7
    Last Post: 03-03-2006, 07:02 PM
  2. PlaySound error
    By Shadow12345 in forum Windows Programming
    Replies: 5
    Last Post: 10-02-2002, 07:10 AM
  3. PlaySound function & Console App
    By GaPe in forum Windows Programming
    Replies: 2
    Last Post: 06-26-2002, 12:25 PM
  4. about playsound()
    By Sekti in forum C++ Programming
    Replies: 0
    Last Post: 04-08-2002, 05:29 PM
  5. PlaySound();
    By tHaPuTeR in forum Windows Programming
    Replies: 2
    Last Post: 03-11-2002, 06:30 AM

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