2

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.

user3038079
  • 137
  • 1
  • 9

1 Answers1

4

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.

dario_ramos
  • 7,118
  • 9
  • 61
  • 108
  • Thanks for the reply. I will try that. But I'm not familiar with setting options through the Command Line and if I can't do it is it a problem to install VS 2010 on my PC and use it's compiler? Are there things that may work on VS2012 but not work on VS2010? – user3038079 Nov 28 '13 at 13:12
  • 2
    If you go the VS2010 way, you will lose some C++11 features compared to VS2012. [This SO question](http://stackoverflow.com/questions/7421825/c11-features-in-visual-studio-2012) discusses the specifics. If you're not using any of those and are certain you won't need them in the future, sure, go for it. I have VS2012, VS2010 and VS2008 in my box and they don't mess each other up, if that worries you. – dario_ramos Nov 28 '13 at 13:18
  • 1
    Aside from C++11 features, other C++ features are discussed [here](http://blogs.msdn.com/b/vcblog/archive/2012/08/14/10339695.aspx) – dario_ramos Nov 28 '13 at 13:24
  • Thanks for the help. I will install VS2010 and use it's compiler. I'm still learning so I will not have to make so big projects that need C++11 features. It's just my hobby :) Thanks again for the help :) – user3038079 Nov 28 '13 at 14:25
  • 1
    @user3038079: You may not _need_ them, but they are very helpful. Perhaps even more if you're still learning: you might as well learn the modern techniques instead of the outdated ways. E.g. `for (auto object : MyObjects)` (this also works with Qt containers) – MSalters Nov 28 '13 at 17:04
  • I installed VS2010 and everything is ok. If I need to use C++11 features I will use VS2012 and make application only for Windows 7 :D – user3038079 Nov 29 '13 at 04:23
  • Did you have to recompile the QT libraries from scratch or just your projects with Visual Studio 2012 - Windows XP? – Darien Pardinas May 16 '14 at 05:52