PDA

View Full Version : Qt 4.5 + QCreator - problems with Win APIs like CreateDC()



will49
8th September 2009, 21:49
I'm trying out using QCreator 1.2.1 with Qt 4.5 on Windows. I have a project that builds fine on Qt 4.3 with VS integration, but am having problems getting it to compile in QCreator.

The app calls into some basic Win32 APIs such as "CreateDC()", "DeleteDC()" and a bunch of others. For some reason it has a problem with "CreateDC()", "DeleteDC()" APIs.

When I compile I get a linker error "undefined reference to 'CreateDCA@16'" in the object code file.

My code is

HDC hdc;
hdc=::CreateDCA("DISPLAY",NULL,NULL,NULL);

Do I need to specifically tell QCreator to link to a certain library? It's weird that it doesn't have a problem with any of the other Win32 APIs I use, just these.

will49
8th September 2009, 21:56
Figured it out - Needed to add the following to my pro file:

LIBS += -lgdi32