Compiling a 32-bit application using Visual Studio on a 64-bit machine

I am trying to compile a simple 32-bit Hello World application written in C using Visual Studio 2010 on a 64-bit machine in a new installation of Windows 7. I also installed the "Windows SDK for Windows 7 and .NET Framework 4" after installing Visual Studio. I created the application by selecting "Win32" as the platform. It works on Windows 7, but if I run the application on my 32-bit machine with Windows XP Professional (this is a new version, without software and service packs), it seems that I cannot get this error:

"This application has failed to start because msvcr100.dll was not found"

If this may be useful, Dependency Walker detects 2 errors (see related image for details):

"Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module."
"Error: Modules with different CPU types were found."

http://img820.imageshack.us/img820/4725/errordp.png (PIcture)

How can i solve this? Thank!

+5
source share
4 answers

Do not trust Dependency Walker on this ... This clearly shows that your exe is 32 bits. Your problem is with the redistributable VC components that are CRT DLLs - find vcredist_x86.exe in your VS installation. You must run it before running the application.

Another option is to statically bind a CRT. See / MT option . Will increase your exe, but keep vcredist stuff.

+2
source

, , . . MSDN.

+3

, C, , Windows XP. Visual Studio 2010 10.0 (msvcr100.dll), XP. C , .

MSDN, , C, Visual Studio 2010

32/64 , , -, .

+2

The answers about the runtime library are correct. Another possible solution is to reference the static runtime libraries, not the DLL version. In this way, you can create an executable file that you can download to any computer without additional deployment problems.

This is a compromise, but without knowing more about your situation, one would think.

+1
source

All Articles