4 Replies - 2467 Views - Last Post: 21 February 2011 - 11:06 PM Rate Topic: -----

#1 jeonsah  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 99
  • Joined: 30-August 09

adding music help devC++

Posted 21 February 2011 - 10:14 PM

Hey guys i am trying to play some sound in my project. I am running DevC++ and its not letting me. I basically have

 
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <windows.h>
#include <fstream>
#pragma comment(lib, "winmm.lib")

int main()
{
PlaySound("Mariachi.mp3", NULL, SND_FILENAME|SND_LOOP);

system("pause");


}



I try to go up to project > project options but it is grey and I cant select anything.... The music file is in the same folder as well.

The error i get is:

[Linker error] undefined reference to `PlaySoundA@12'


thanks!


Is This A Good Question/Topic? 0
  • +

Replies To: adding music help devC++

#2 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5395
  • View blog
  • Posts: 27,389
  • Joined: 10-May 07

Re: adding music help devC++

Posted 21 February 2011 - 10:17 PM

View Postjeonsah, on 22 February 2011 - 12:14 AM, said:

The error i get is:

[Linker error] undefined reference to `PlaySoundA@12'

Where did you get documentation or reference for that function? Also, do you actually have the library file winmm.lib?
Was This Post Helpful? 0
  • +
  • -

#3 jeonsah  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 99
  • Joined: 30-August 09

Re: adding music help devC++

Posted 21 February 2011 - 10:48 PM

View Postno2pencil, on 21 February 2011 - 10:17 PM, said:

View Postjeonsah, on 22 February 2011 - 12:14 AM, said:

The error i get is:

[Linker error] undefined reference to `PlaySoundA@12'

Where did you get documentation or reference for that function? Also, do you actually have the library file winmm.lib?



Well I tried reading all over how to add in music and a bunch of people said you needed, this header and that header. So I just added a bunch. Im not quite sure what most of them do.

The actual linker error is the error I get when I try to compile+run. It was just copied and pasted.
Was This Post Helpful? 0
  • +
  • -

#4 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5395
  • View blog
  • Posts: 27,389
  • Joined: 10-May 07

Re: adding music help devC++

Posted 21 February 2011 - 10:50 PM

Do you actually have the library file winmm.lib?

As per the MSDN documentation for the function, that library file is required. Just typing it into a define doesn't accomplish anything unless the compiler & linker can find it.
Was This Post Helpful? 0
  • +
  • -

#5 jeonsah  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 99
  • Joined: 30-August 09

Re: adding music help devC++

Posted 21 February 2011 - 11:06 PM

View Postno2pencil, on 21 February 2011 - 10:50 PM, said:

Do you actually have the library file winmm.lib?

As per the MSDN documentation for the function, that library file is required. Just typing it into a define doesn't accomplish anything unless the compiler & linker can find it.


I dont believe i do. Where do i get it? and what do i do with it?

This post has been edited by jeonsah: 21 February 2011 - 11:06 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1