I have found an example where gdi32.lib should be linked in some way, but I don't know how to do this from GCC command line. All the examples I've found suggest to do this somewhere in project properties in MS Visual Studio or Eclipse.
bsod.cpp:
#include <windows.h>
int main() {
HDC dc = CreateCompatibleDC (NULL);
SetLayout (dc, LAYOUT_RTL);
ScaleWindowExtEx (dc, -2147483647 - 1, -1, 1, 1, NULL);
}
My GCC compiler is from Ruby Development Kit (seems to be MinGW).
Just add this to the link command line:
-lgdi32
So that e.g. your link line will look like
gcc -o executable somemain.o -lgdi32
Make sure the library is specified after anything that needs it.
For example, if you have a single C++ source file named myprog.cpp
, you would run
g++ -o myprog myprog.cpp -lgdi32
Or seperate the commands
g++ -c myprog.cpp
g++ -o myprog myprog.o -lgdi32
You can add optimization or debug options to the first two commands. The link command doesn't really need anything else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With