[Qt-interest] [ActiveQt]WINVER set incorrectly

Jonathan Locke jonathan at rtsw.co.uk
Wed Dec 3 15:51:06 CET 2008


I'm using the ActiveQt library to create an ActiveX component that uses 
another proprietary interface. To do this, my class subclasses 
QAxAggregated, as well as the custom interface class. I have the IDL for 
the interface, and I've used MIDL to generate the .h and .c files. 
However, when I try to compile my project, I get an error from the 
<interface>_p.c file generated by MIDL - it tells me that I need to be 
using Windows 2000 or later in order to run this stub. However, I am 
using Windows XP SP2. The error in question is thrown by a preprocessor 
statement, which checks a define called TARGET_IS_NT50_OR_LATER. That 
define is set in rpcndr.h, based on _WIN32_WINNT and WINVER.

In summary, my compiler is incorrectly assuming that I'm using something 
earlier than Windows 2000 when I'm actually using Windows XP. I see that 
when moc is run on my files, one of the arguments passed to it is to 
define WINVER as 0x501 (ie Windows XP). If I manually define WINVER 
myself in my Visual Studio project settings, I get an error from moc 
saying I cant pass it more than one input file. Defining WINVER in my 
class or in the <interface>_p.c has no effect, but defining 
TARGET_IS_NT50_OR_LATER as 1 does of course let me compile that file. 
However, I get linker errors later on, so I'm guessing that the cause of 
the compiler guessing that I am using the wrong version of windows might 
well be involved.

I am using Visual Studio 2005 on Windows XP SP2, and I do include 
windows.h in my main class header file.

Any help would be appreciated.



More information about the Qt-interest-old mailing list