Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MS Visual Studio 2012 Express for Windows Desktop - Targeting Windows XP

I have recently upgraded from Visual Studio Express 2010 to Visual Studio 2012 Express for Windows Desktop. I'm aware of the previous lack of compatibility targeting Windows XP, but thought this was resolved by Update 1 (which I have installed).

However, I'm still having difficulty targeting Win XP with the C++ applications I have compiled using 2012 Express. I have set the Platform Toolset to "Visual Studio 2012 - Windows XP (v110_xp)" but this makes no difference. When I try to run my compiled application on my Windows XP system (I run Windows XP via VirtualBox), I get an the error that my application "is not a valid Win32 application."

I have also tried setting the CLR Support to "No Common Language Runtime Support" and the Runtime Library to "Multi-threaded (/MT)".

Even with a very basic blank C++ project using the following code, I just can't get it to run on XP:

#define _WIN32_WINNT 0x0501
#define WINVER 0x0501
#define NTDDI_VERSION 0x0501

#include <iostream>

int main()
{
    std::cout << "TEST" << std::endl;

    std::cout << std::endl << std::endl << "Press ENTER to close this window.";
    std::cin.get();
    return 0;
}

Can anybody tell me where I'm going wrong with my compiler/project settings?

P.s. I have installed the MS VC++ 2010 and 2012 redistributable packages on my XP virtual machine. Applications that I compiled with Visual Studio Express 2010 work fine on my XP virtual machine.

like image 675
Colin Avatar asked Jan 13 '13 18:01

Colin


People also ask

Does Visual Studio 2012 support Windows XP?

Hardware requirements. Visual studio 2012 may not work on Windows XP Or Windows Vista. You need windows 7, Windows 8, Windows Server 2008 R2 Or Windows Server 2012.

Which version of Visual Studio is compatible with Windows XP?

Support for Windows XP development is available by using the Visual Studio 2017 v141_xp toolset.

Is Visual Studio 2012 Express free?

Today Visual Studio has made Visual Studio Express 2012 for Windows Desktop available and you can go download it now free. The best part is that this one SKU supports C++, C#, and Visual Basic together.

Is Visual Studio 2012 still supported?

Visual Studio 2012 - Microsoft Lifecycle | Microsoft Learn. This browser is no longer supported. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.


2 Answers

Check your project's "Configuration Properties -> Linker -> System -> Subsystem" properties.
If blank, fill it with (/SUBSYSTEM:CONSOLE) or (/SUBSYSTEM:WINDOWS).

like image 126
Cherio Avatar answered Oct 08 '22 04:10

Cherio


This works:

Configuration Properties -> Linker -> System -> Subsystem = /SUBSYSTEM:WINDOWS

Configuration Properties -> General -> Platform Tool Set -> SubsystemVisual Studio 2012 - Windows XP (v110_xp)

Using Visual Studio 2012 Express Update 3.

like image 26
user2529511 Avatar answered Oct 08 '22 04:10

user2529511