21

I usually hate asking questions but this one has me stumped.

I am creating a small game using C++ and Allegro5 in Visual Studio Professional 2013. I have used the Visual Studio 2013 – Windows XP (v120_xp) platform toolset, and made sure the Visual C++ 2013 redistributable was installed on the target machine.

I am developing using Windows 8.1, the target machine is running Windows XP SP2.

Whenever I attempt to run the program I receive a message stating .exe is not a valid Win32 application.

Even though I am not using anything related to .NET I have made sure that was installed on the target machine as well.

I have also made sure that the program itself is a 32 bit application.

I am really not sure what to try next. I have searched for the past few hours and made sure that anything necessary was installed. I am still rather new at this so it's quite possible I overlooked something simple, but I can't for the likes of me think of what.

user3006910
  • 211
  • 1
  • 2
  • 4
  • 1
    http://stackoverflow.com/q/19724029/62576 – Ken White Nov 19 '13 at 01:19
  • Not that you likely haven't tried this, since it seems you were fairly thorough in your gauntlet, but is the same problem present when compiling and distributing an out-of-the-box no-depenencies Win32 app (Hello, World!) ? Just curious if this is reducible to something outside your application's purvey, and instead your toolset or distribution mechanism. – WhozCraig Nov 19 '13 at 01:36
  • I had tried it during my initial troubleshooting but I didn't try a "Hello World" application after I had gotten to my most recent state. So I just went and tested again using a "Hello World" and it is giving me the same error as the game. ".exe is not a valid Win32 application". In short (because I can be confusing when I type) I get the same problem with a fresh, brand new "Hello World" project. – user3006910 Nov 19 '13 at 02:07
  • 4
    v110_xp had a minimum supported version XP SP3. I am confident v120_xp has the same. You will have to install XP SP3 – cha Nov 19 '13 at 03:47
  • 1
    Just upgraded the system to SP3. Problem persists. – user3006910 Nov 19 '13 at 06:21
  • Did you use Dependency Walker ? What did it say? – MSalters Nov 19 '13 at 07:51
  • 1
    64 bit module somewhere in dependency chain is most likely – David Heffernan Nov 19 '13 at 08:13
  • Never heard of Dependency Walker before now so thank you for that, it will make my life easier in the future. Anyways, ran D.W. on my hello world application, no errors presented themselves, was able to locate all dependencies on the target system, and it appears as though all of the dependencies are listed as x86, which to my understanding would rule out any rogue x64 bits in there. Now I'm really puzzled. – user3006910 Nov 19 '13 at 14:11
  • Can't tell if this is resolved for you or not. Maybe setting the SubSystem to Windows in your project will help. You may also need a MinimumRequiredVersion as well. – DSway Apr 17 '14 at 16:10

3 Answers3

14

you have to set the Platform Toolset configuration from properties (preview)

Set its value to v120_xp and it should work on windows xp.

read the post http://supportxpdotcom.wordpress.com/2013/07/16/xp-targeting-support-in-the-visual-studio-2013-preview/

see the comments http://blogs.msdn.com/b/vcblog/archive/2013/06/26/visual-studio-2013-preview-now-available.aspx

Imran Rizvi
  • 7,331
  • 11
  • 57
  • 101
  • As I stated in my question, I have already done that. I have also read those threads over multiple times before posting this question. – user3006910 Nov 19 '13 at 14:13
8

I've just had the same problem now fixed. You might have forgotten to set SUBSYSTEM:

Go to project properties -> linker -> system and set as appropriate.

Details here: http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx?PageIndex=2

dk123
  • 18,684
  • 20
  • 70
  • 77
1

Probably the problem is caused by other compiler option: /arch (enable enhanced instructions set). Try to set it to /arch:IA32 (no enhanced instructions).