Hi All,
I'm trying to make commandline mp3 player using libwmp3. I use codeblocks and have tried alot and I get error below. I have tried to include libwmp3.h, add libwmp3.a try changing compiler; but no success :(

Please help me to get through. I use the code for mp3 player posted at their site.

Thanks

expected constructor or destructor or type conversion before "->" token .

Recommended Answers

All 2 Replies

<psychic_debugging>
I'm willing to bet that you copied the code from that site without adding the necessary scaffolding. For example, executable (as opposed to declarative) code needs to be wrapped in a function:

#include <windows.h> // Assuming this for Sleep
#include "libwmp3.h"

int main()
{
  /* create class instance */
  CWMp3* mp3 = CreateCWMp3();

  /* open file from disk */
  mp3->OpenFile("mysong.mp3",800, 0, 0);
  mp3->Play();

  /* ... wait here in some loop */
  MP3_STATUS status;

  mp3->GetStatus(&status);

  while(status.fPlay)
  {
      Sleep(200);
      mp3->GetStatus(&status);
  }

  /* destroy class instance */
  mp3->Release();
}

</psychic_debugging>

I'm willing to bet that you copied the code from that site without adding the necessary scaffolding.

You bet it! You are really here to prove me wrong. It is kinda foolish to forgot main. It is like trying entering without a door ;)

Thanks Narue

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.