Question

I have an SConstruct file for scons:

env = Environment()
env.Append(CPPPATH = ['./'])
env.Append(LIBS = 'kernel32.lib')
env.Append(LIBPATH = 'C:/Program Files/Microsoft SDKs/Windows/v6.0A/Lib')

env.SharedLibrary(target='warpLib', source='warplib.cpp')

If I don't inlcude 'kernel32.lib' and specifiy the LIBPATH I get a link error. My solution works, but doesn't look very portable ... What is a better, more portable solution?

Was it helpful?

Solution

Use SCons declaration 'DefaultEnvironment(ENV=os.environ)'.

OTHER TIPS

Rather than calling scons from a standard command line, use the visual studio command prompt, that will set up all your environment variables correctly

I prefer to use the following syntax because it reminds me that I am ultimately using Python, and prefer to use the native Python list commands than their pseduo SCons equivalents. Additionally, it helps me remember that CPPATH,LIBS,LIBPATH, etc are all lists.

env = Environment()
env["CPPPATH"].extend(["."])
env["LIBS"].extend(["kernel32","someotherlib"]) #No need to specify the ".lib". This gives you platform-independance automatically.
env["LIBPATH"].extend(["C:/Program Files/Microsoft SDKs/Windows/v6.0A/Lib"])
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top