Take the 2-minute tour ×

can someone give a scons config file which allows the following structure

        /src - .cc files
        /include .h files

at top level I want the o and final exe.

share|improve this question
add comment

3 Answers

Here is one example of Sconscript file

env.Program('runme', Glob('src/*.c'))

(The environment line is not really necessary for the example, but I have it to include the non standard glib header path and left it there so you can get the idea how to add extra includes and defines)

The source files are in src directory and header files in inc directory. You run scons from the base directory and the output file is also generated in the same directory.

share|improve this answer
add comment

This question: http://stackoverflow.com/questions/279860/... gives a pretty flexible scons skeleton which should serve your needs with a few tweaks to the path variables.

share|improve this answer
I think this answer is too difficult for most people new to scons. VariantDir? (for example) and assumes knowledge of Python. –  Richard Riley Nov 19 '08 at 22:22
Your assumption is correct Richard. I have no idea what that config file does but I think I managed to pull something useful from it. –  advocate Apr 13 '12 at 18:17
add comment
up vote 3 down vote accepted

if ARGUMENTS.get('debug', 0):
    env.Append(CCFLAGS = ' -g')

env.Program('template', Glob('src/*.cc'))

Worked a treat. Thanks.

share|improve this answer
How do we make the object files(*.o) go into a newly created folder called obj –  Alwin Doss May 31 '13 at 2:53
add comment

Your Answer


