2

Phenomenon:

Build a c++ program using visual studio express 2015 on windows 7 platform. Copy the executable file to xp system, cannot run with the error"not a valid win32 application"

Have tried two things

  1. go to "configuration properties" and set the "Platform Toolset" to "visual studio 2015 - windows xp(v140_xp)"

  2. go to "configuration Manager" and set the Platform to "Win32" (instead of x64) after these steps, still gives me same problem.

anyone knows what is the root cause of this problem? thank you!

Jacob
  • 47
  • 1
  • 5
  • Make sure you are deploying the dlls with the executable: http://stackoverflow.com/questions/11305633/xxxxxx-exe-is-not-a-valid-win32-application – ce_nort Mar 30 '16 at 16:18
  • You did these steps in the wrong order, the platform toolset is a per-platform setting. Or in other words, you only changed the setting for x64, not for Win32. Just do it again. And don't forget to update the Release configuration as well. – Hans Passant Mar 30 '16 at 16:29
  • @ce_nort where can I find the msvcr100.dll ? just search it in c:? – Jacob Mar 30 '16 at 16:55
  • @HansPassant Hi, thanks for your advice. I swapped the two steps and set the release config to win32, I still have the same error. – Jacob Mar 30 '16 at 17:02
  • I have the same issue. I was able to make it work last night. I forgot now. Three things you need as far as I can remember. Toolset to XP CodeGeneration to Multi-threaded Platform = x86 Statically Link Libraries – Luigi Sep 13 '16 at 15:51
  • Statically linking libraries is not necessary. – Freitags Jun 30 '17 at 19:00

1 Answers1

1

The main problem is the Windows SDK that you are using.

Most recent Windows SDK have a compatibility list that will go far back to Windows 7.

Here are two useful links:

Ajay
  • 18,086
  • 12
  • 59
  • 105
And Wan
  • 314
  • 1
  • 3
  • 12
  • I noticed "Visual Studio 2012 – Windows XP (v110_xp)" is on the older version of visual studio. visual studio 2015 actually automatically help me to update SDK kits. So I feel like sdk version should not be an issue. or there maybe a way to set the targeting kit? – Jacob Mar 30 '16 at 16:59