Forcing scons to use older compiler?
Asked Answered
I

2

8

I have a C++ project which is using boost. The whole project is built using scons + Visual Studio 2008. We've installed Visual Studio 2010 and it turned out scons was attempting to use the later compiler instead of the old one - and failed to build the project as boost and visual studio 2010 don't like each other very much - yet. We'd like to suppress this and force scons to use the 2008 version. Is this possible? How do we do this?

Inhume answered 20/6, 2010 at 13:16 Comment(0)
C
16

You can modify the scons Environment() by just choosing the version you want:

env = Environment(MSVC_VERSION=<someversion>)

From the scons manpage:

MSVC_VERSION Sets the preferred version of Microsoft Visual C/C++ to use.

If $MSVC_VERSION is not set, SCons will (by default) select the latest version of Visual C/C++ installed on your system. If the specified version isn't installed, tool initialization will fail. This variable must be passed as an argument to the Environment() constructor; setting it later has no effect. Set it to an unexpected value (e.g. "XXX") to see the valid values on your system.

Cinema answered 21/6, 2010 at 10:33 Comment(3)
I'll try that tomorrow morningInhume
env = Environment(MSVC_VERSION=9.0) Worked.Inhume
MSVC_VERSION='11.0Exp' for making 2012Express.Selvage
B
2

You'll need to redefine the CXX construction variable, ideally in your Environment:

env = Environment(CXX = "C:\\path\to\vs2008\executable")
Blackface answered 20/6, 2010 at 13:23 Comment(1)
Hi, sorry about the late reply, I'll give it a shot tomorrowInhume

© 2022 - 2024 — McMap. All rights reserved.