I have a directory:
src
sconscript
main
sconstruct
main.cpp
In the sconscript, I write
env=Environment(CXX='g++',LINK='g++')
In the sconstruct, I write
SConscript('../sconscript',exports='env')
Import('env')
env.Program(target='a.out',source='main.cpp')
And then I go to directory src/main and type scons -Q, it just complains:
Export of non-existent variable ''env''
From http://scons.org/doc/HTML/scons-user.html#idm139837640372096, I think the syntax is correct. So what is the problem?
I use ubuntu 16.04, Python 2.7.12 and scons 2.5.0
Your SConscript should read
Your SConstruct should read
Take a look at the manpage: http://scons.org/doc/production/HTML/scons-man.html