You don't need winmm.a to build latency.c
you need
libpmjni.dll.a
, libportmidi.dll.a
or
libportmidi_s.a
To build portmidi wit CMake takes 5 minutes.
- portmidi source : c:/src/portmidi217/
- portmidi build : c:/minGW/portmidi
Then you can compile it with the following command.
gcc.exe -c -g -I/c/src/portmidi217/pm_common -I/c/src/portmidi217/porttime -MMD -MP -MF build/Debug/latency.o.d -o build/Debug/latency.o latency.c
mkdir -p dist/Debug
gcc.exe -o dist/Debug/latency build/Debug/latency.o -L/c/minGW/portmidi -lpmjni.dll -lportmidi.dll
Building portmidi with CMake
- Download or use Cmake
- in c:\cmake\bin folder double click
cmake-gui.exe
unzip portmidi to the folder c:\minGW\src\portmidi217
you can see in the next image
(replace all T:\
with C:\
of course)

press configure

settings as described --> click next

settings as described --> click ok

there a errors so click configure again

next looks better click configure again

settings as described Release or Debug
maybe it worked without c:\msys\1.0\bin\sh.exe
click configure again

looks good --> click Generate

cd to your just builded c:\minGW\portmidi

open windows command type make

it takes a short time to build

there they are : .a and .dll

- copy all
.a
to c:\minGW\lib
- copy all
.dll
to c:\minGW\bin
- copy from
C:\minGW\src\portmidi217\pm_common
and C:\minGW\src\portmidi217\porttime
all .h to the folder where your latency.c
is.
Then you can latency.c
compile as described above, you just need to adjust the paths.