Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xxxxxx.exe is not a valid Win32 application

I have small C/C++ project in Visual Studio 2012 RC

This applications parses the argv and then calling another .exe file with ShellExecute

My application works perfect on Windows7 but on Windows XP x86 trhows Is not a valid Win32 application error.

I have compiled it with Mutli-thread(/MT) and Win32 Platform

This is my #includes

#include <string> #include <iostream> #include <Windows.h> #include <fstream> #include <cstdio> #include <vector> #include <windowsx.h> #include <shlobj.h> #include <stdio.h> #include <tchar.h> #include <direct.h> 

Thanks

like image 404
user525717 Avatar asked Jul 03 '12 06:07

user525717


People also ask

Is not a valid Win32 application on 64-bit machine?

- If the program is an older MS-DOS program or early Windows program you may get this error. - If the program is designed for a 64-bit version of Windows and you're running it in a 32-bit version of Windows, it will not work and generate this error. File is a virus, worm, or other malware file.


1 Answers

It's Feb 2013, and I can now target XP in VS2012 by setting:

Project Properties -> General -> Platform Toolset to:

Visual Studio 2012 - Windows XP (v110_xp)

You will have to redistribute the msvcp110.dll libraries et al with your application, which are found here: "<Program Files>\Microsoft Visual Studio 11.0\VC\redist\x86\Microsoft.VC110.CRT\"


Update Aug 2015 with Visual Studio 2015

There seems to be quite a selection now. I was able to compile application in VS2015 using Visual Studio 2015 - Windows XP (v140_xp) setting. To make it actually run on Win XP I had to deploy (copy alongside application) msvcr100.dll for Release build and msvcr110.dll and msvcr100d.dll for Debug build (note there is a difference in numbers 100 and 110, also debug lib msvcr100d.dll may not be redistributable) Targeting Windows XP with Visual Studio 2015

like image 188
noelicus Avatar answered Oct 19 '22 07:10

noelicus