Eclipse CDT - problem linking to windows lib files

2019-05-08 04:03发布

问题:

I'm getting the folling linker errors when compiling with gcc:

undefined reference to `SetStretchBltMode@8' 
undefined reference to `StretchDIBits@52' 
undefined reference to `SetDIBitsToDevi

Are these functions defined in the windows libs?

If so do they come installed with Vista, or do I need to install them, and if so where can i download them.

Thanks

回答1:

I know you solved your problem long ago, but for reference, I think you should be able to run g++ with -mwindows and that'll link gdi32.dll and comdlg32.dll with your binary automatically.

This page has a tutorial for Win32 on MinGW



回答2:

Ok - worked this out:

libgdi32.a comes with mingw.

You need to add -lgdi32 to the g++ command!

Make sure that the path to mingw/lib is also provided to g++ eg: -Lc:/mingw/lib