SDL plays .wav extension audio but it wont work with .mp3 files doesn't SDL support mp3 files or do i need to convert it to .wav file first , if it's not clear i will paste the code
Now after retrying i get run time error:
The program can't start because libstdc++ -6.dll is missing from your computer.Try reinstalling the program to fix this problem.
I can't find any libstdc++ -6.dll file on the system
As far as I know, SDL doesn't natively support the play back of .mp3 files. This is due to the use of an MP3 decoder requiring complicated licensing issues. See https://en.wikipedia.org/wiki/MP3#Licensing_and_patent_issues
Basically, yes, you have to convert to a WAV file first. In the future, prefer to get you audio in an open-source format such as Ogg Vorbis, as that is free of licensing issues, and thus SDL is more likely to have a decoder for it.
EDIT:
libstdc++-6.dll is a DLL that is used by MinGW as the standard library. If you go to the 'bin' folder of your MinGW folder, you should find the DLL there. If you aren't using MinGW, then you might need to rebuild SDL using your compiler to prevent errors like that.
It looks likeSDL_mixer has supported mp3 files since version 1.0 so I don't think it's a version problem, but if you want you could upgrade and see if that makes a difference. The docs mention something about SMPEG or the MAD library so maybe you have to install one of them or something. I'm not sure.
What error message does it give you after you have failed to load the mp3 file?
After trying to load mp3 file using your code given gives me a run time error:
The program can't start because libstdc++ -6.dll is missing from your computer.Try reinstalling the program to fix this problem.