user3038079
user3038079

Reputation: 137

Using Visual Studio 2012's compiler to make Qt applications for Windows XP

I know that since VS2012, Microsoft has stopped the support for Windows XP. There is an update for VS2012 so developers could make applications that are supported by Windows XP. Right now I started learning the Qt library. I use Qt Creator and the compiler that I use is from VS2012. Is there a way to select option in Qt Creator so it can produce a valid 32-bit exe for XP? Or is it better to install on my PC VS2010 and use it's compiler? By the way I'm making the applications on Windows 7 and everything works.

Upvotes: 2

Views: 875

Answers (1)

dario_ramos
dario_ramos

Reputation: 7309

We are currently using VS2012 and taking advantage of the update you mentioned to target our VC++ binaries to Windows XP. It's working fine. In Visual Studio, we do this by going to the project properties, Configuration Properties->General->Platform Toolset and selecting "Visual Studio 2012 - Windows XP (v110_xp)".

Checking the compiler command line options (Configuration Properties->C/C++->Command Line), it seems that the switch which tells the compiler to target XP is the following:

/D "_USING_V110_SDK71_"

And in the link command line options:

/SUBSYSTEM:WINDOWS,5.01
/SUBSYSTEM:WINDOWS,5.02

First one for x86, second one for x64 (use only one). If it's a console application, use these instead:

/SUBSYSTEM:CONSOLE,5.01
/SUBSYSTEM:CONSOLE,5.02

I changed the platform toolset and these went away, so I guess they are what you need. In QtCreator, you should edit the compiler and linker command line options accordingly.

Edit: If that doesn't work, try the instructions from the "Targeting from the Command Line" section on this article.

Upvotes: 4

Related Questions