Please note:The SCons wiki is now restored from the attack in March 2013. All old passwords have been invalidated. Please reset your password if you have an account. If you note missing pages, please report them to Also, new account creation is currently disabled due to an ongoing spam flood (2013/08/27).

This is the shortest SConstruct for creating an executable

#need glob to get all the source files
import glob
import os

#create an environment that uses mingw tools
#FIXME: clobbers env['TOOLS']
env = Environment(ENV=os.environ, tools=['mingw'])

#the target will be myprogram.exe (in win32)
#the source files will be every file in the 
#current directory that matches "*.cpp"
env.Program(target='myprogram', source = glob.glob('*.cpp'))

errata: don't need the .exe in the target name

errata: don't need to Split() the glob

errata: don't forget to set the ENV argument in the call to Environment(); import os also

errata: don't set tools= in the Environment(), use Tool('mingw')(env) to avoid clobbering env['TOOLS']

The page had this code instead:

#create an environment that uses mingw tools
env = Environment(ENV=os.environ)
#Prefer MinGW over other compilers

I couldn't get this to work. As of version 2.3.0, It would pass /nologo (an MSVC flag) to g++, causing the build to fail.

SconstructShortMingwWin32 (last edited 2013-04-04 14:37:12 by GaryOberbrunner)