Visual Studio Command Compiler compiles 64 bit

I am trying to create an executable and some associated DLLs in the VS command line VS. The project comes with a scons file, so I just type scons in VS Cmd Prompt.

The executable is embedded in the "x86" VS Cmd Prompt. However, the executable is not 32 bit when running (confirmed by the task manager). My colleague is building the same exact project on his 64 bit machine using scons file and his executable is 32 bit on my computer. (confirmed again by task manager)

The DLLs are loaded by the 32 bit JVM and they throw an error as they are 64 bit. My colleagues don't have dlls.

We cannot figure out why my computer is forcing a 64-bit build inside the VSX "x86" environment. Does anyone have any suggestions?

PS - I have MS VS 2010 and it has MS VS 2010 Express.

PSS - I have 64-bit python, and thus my sons are 64-bit too. However, however, my colleague.


source to share

2 answers

Usually scons determines which toolchain (i.e. the compiler) to use (unless you explicitly specify it) based on what it can find.

Visual Studio 2010 Express can only create 32-bit binaries - even on 64-bit Windows - so that's what Scons will do. In Visual Studio 2010 "non-express", which has both 32 and 64 bit compilers available, Scons will presumably ship to a 64 bit build on 64 bit Windows.

To specify the 32- or 64-bit build of the Scons project, you can set TARGET_ARCH

to "x86" or "x86_64" respectively. See Also Scons Construct Variables .



As an alternative solution for esskov's, you can force SCons to use an environment variable PATH

, which will force it to use the same compiler that you get when you type cl

at the command line (which can be installed correctly by running the appropriate command line shortcut provided by Visual Studio). To do this, propagate the PATH environment variable to the SCons build environment, for example:

import os
env = Environment(ENV = {'PATH' : os.environ['PATH']})


See this FAQ or this section of the documentation , and pay attention to the following warning:

Of course, by propagating external environment variables into your build, you run the risk of changing the external environment affecting your build, perhaps unintentionally.



All Articles