View Full Version : problems including platform SDK headers

20th January 2010, 21:07
I don't like the results I'm getting with QProcess, so I would like to do a sanity check of my parameters to make sure they still work with the WIN32 code I am porting. I tried including <shellapi.h> and also <windows.h> with no success, trying to use the ShellExecute function. I am seeing many compile errors because of missing type definitions.

How can I setup the build environment so that I can include platform SDKs?

I'm developing in Creator (and loving it). Customizing the build has been difficult for me. Any tips are much appreciated?


20th January 2010, 22:45
try including "QtCore/qt_windows.h" - it should include all necessary headers and defines. After which include your <shellapi.h> (<windows.h> is already included by at_windows.h)

20th January 2010, 23:35
I guess using platform headers does work out of the box. I realized the compile error came from the example code I pasted from MSDN using ShellExecute. I removed everything but the use of ShellExecute, included <windows.h>, and had no compile errors. I still needed to link to the windows shell library, and I figured out how to do that from the .pro file, LIBS += shell32.lib.

Thanks for the suggestion. I don't understand the reason for the Qt platform headers, I suspect they are for internal use. I was expecting an answer like "put CONFIG += windows in your .pro file".

Another tip, I'm using DEFINES+=UNICODE in my .pro file to get use of Unicode versions of platform code. For example, now I can feed QString (converted to stdW string) right into the arguments of ShellExecuteW.