I was trying the example code on "How to Play Media Files with Media Foundation", and I tried to compile the code with the following makefile:
LDFLAGS = -LC:\\pathToWindowsSDK\\Lib\\10.0.22000.0\\um\\x64 -lMfplat -lMfuuid -lUser32 -lOle32 -lShlwapi -lMf
default: winmain.o player.o
g winmain.o player.o -o a.exe
winmain.o: winmain.cpp player.h
g winmain.cpp -c
player.o: player.cpp player.h
g player.cpp $(LDFLAGS) -c
and I keep getting the following undefined references:
C:/Personal/Soft/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: player.o:player.cpp:(.rdata$.refptr.GUID_NULL[.refptr.GUID_NULL] 0x0): undefined reference to `GUID_NULL'
C:/Personal/Soft/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: player.o:player.cpp:(.rdata$.refptr.MR_VIDEO_RENDER_SERVICE[.refptr.MR_VIDEO_RENDER_SERVICE] 0x0): undefined reference to `MR_VIDEO_RENDER_SERVICE'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:4: default] Error 1
Both are undefined errors of GUID, is there a library that I should link? I'm using MSYS g compiler, and Windows 11 SDK (10.0.22000). Thanks in advance!
CodePudding user response:
Try adding -luuid (Visual C projects created through Visual Studio link to uuid.lib by default).