在pro文件中,添加如下:
win32 {
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS,5.01
QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE,5.01
DEFINES += _ATL_XP_TARGETING
QMAKE_CFLAGS += /D_USING_V120_SDK71_
QMAKE_CXXFLAGS += /D_USING_V120_SDK71_
LIBS += -L$$quote(C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib)
NCLUDEPATH += $$quote(C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include)
QMAKE_TARGET_OS = xp
}
编译即可