0

I am trying to implement my own thumbnail provider by following Microsoft's thumbnail provider code sample. The code has been coming together nicely, but now I needed to figure out a way to compile (on Windows). MSYS2 appears to be a popular option.

g++ -shared -o GrmgThumbnailProvider.dll -lshlwapi -lgdi32 Dll.cpp GrmgThumbnailProvider.cpp

This causes errors:

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\Zyl\AppData\Local\Temp\cc5HnXOH.o:Dll.cpp:(.text$_ZN13CClassFactory14QueryInterfaceERK5_GUIDPPv[_ZN13CClassFactory14QueryInterfaceERK5_GUIDPPv]+0x31): undefined reference to `QISearch'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\Zyl\AppData\Local\Temp\ccXzQLhd.o:GrmgThumbnailProvider.cpp:(.text+0x36f): undefined reference to `__imp_CreateDIBSection'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\Zyl\AppData\Local\Temp\ccXzQLhd.o:GrmgThumbnailProvider.cpp:(.text$_ZN18CGrmgThumbProvider14QueryInterfaceERK5_GUIDPPv[_ZN18CGrmgThumbProvider14QueryInterfaceERK5_GUIDPPv]+0x31): undefined reference to `QISearch'
collect2.exe: error: ld returned 1 exit status

The libraries are definitely found: g++ complains if I change the library names in the -l argument to some nonsense. How is it these references cannot be resolved despite the required libraries being both present and found?

Zyl
  • 2,690
  • 2
  • 22
  • 27
  • 1
    you need to put your libraries after your cpp files – Alan Birtles Oct 03 '22 at 20:17
  • 2
    The most popular option to compile on Windows is probably Visual Studio (there's a free community edition available). It's certainly the most simple option. Lots of problems with GCC and MSYS with out-of-date headers, etc. – Simon Mourier Oct 03 '22 at 20:17

0 Answers0