I'm trying to play the song in simple console executable. However after running the .exe the song doesn't play and the windows notification sound appears instead in loop. The resources are created properly (l am using Codeblocks so l can see them in /obj/debug/) so l suppose that's because the PlaySound() path that l set doesn't lead to the right directory.
How to set the path to resources in PlaySound() function? Thank you in advance
play/main.cpp:
#include <iostream>
#include <thread>
#include <windows.h>
#include <mmsystem.h>
void play() {
PlaySound(TEXT("a18.wav"), NULL, SND_FILENAME|SND_LOOP|SND_ASYNC);
}
int main() {
std::thread t(play);
system("pause>>nul");
t.join();
return 0;
}
play/song.rc:
song WAVE "/rsrc/a18.wav"