Fatal error LNK1120 - mciSendString ?

Hi,
I'm trying to get the mciSendString working to play a mp3 file.
But when I try to compile I get the following error:
fatal error LNK1120: 1 unresolved externals

I can't seem to find the problem.

My function is quite simple:
1
2
3
4
5
6
void play_mp3() {

mciSendString(L"open \C:\Documents and Settings\Simon\Dokumenter\Musik\2pm\ type mpegvideo alias MediaFile", NULL, 0, NULL);
mciSendString(L"play Mediafile", NULL, 0, NULL);

}


Regards,

Simon H.A.
Can you post the full error please.
1
2
1>Shatronics_mp3_player.obj : error LNK2019: unresolved external symbol __imp__mciSendStringW@16 referenced in function "void __cdecl play_mp3(void)" (?play_mp3@@YAXXZ)
1>C:\Documents and Settings\Simon\Dokumenter\Elektronik\Programmering\VisualC++\Codes\Shatronics_mp3_player\Debug\Shatronics_mp3_player.exe : fatal error LNK1120: 1 unresolved externals


That's what it says.

Regards,

Simon H.A.
You need to link to WinMM.lib in the Platform SDK.
Thanks,
Now the code will compile. But it doesn't work.
I've added some changes, but it wont work.
The code is based on this site: http://www.gamedev.net/reference/articles/article2053.asp
1
2
3
4
5
6
7
8
9
10
11
12
13
void play_mp3(TCHAR *filename) {

TCHAR command[MAX_PATH] = L"open \"";

_tcscat(command,filename);
_tcscat(command,L"\" type mpegvideo alias ");
_tcscat(command,filename);
command[_tcslen(command)] = 0;

mciSendString(command, NULL, 0, 0);
mciSendString(L"play mediafile", NULL, 0, 0);

}


The file direction is collected from another function that works perfectly, so the problem shouldn't be there.

Regards,
Simon H.A.
Last edited on
I got the problem solved.
I just changed the alias to a more simple name such as "musicfile" and used that instead.
Now it works perfectly.

Thanks for your help kbw.

Regards,

Simon H.A.
Topic archived. No new replies allowed.