If you have winmm.dll and add the option, the compilation is well.
But, after the exevution, the process could not print their messages like skip the api waveOutOpen.
--- compilation and execution 001 ---
> .\a.exe
main starts.
allocaton well:
main ends.
> mingw32-c++.exe .\sounds-011.o main.cpp
.\sounds-011.o:sounds-011.cpp:(.text+0x83): undefined reference to `waveOutOpen@24'
collect2.exe: error: ld returned 1 exit status
>
> mingw32-c++.exe .\sounds-011.o main.cpp -lwinmm -mwindows
> .\a.exe
>
--- compilation and execution 001 ---