What code do you have to write in SConstruct file, so that on build all included classes in subdirectories compile? At the moment my SConstruct file looks like this:
VariantDir('build', '.')
env=Environment(CPPPATH=['#'],
CPPDEFINES=[],
LIBS=['-lpng', '-lassimp', '-lglfw3', '-lGLEW', '-lGLU', '-lGL', '-lX11', '-lXxf86vm', '-lXrandr', '-lpthread', '-lXi'],
CXXFLAGS="-std=c++11")
env.Program(target='exec_test', source=[Glob('build/*.cpp')])
And when i build my project, i get undefined reference to
errors when calling methods in classes that are in subdirectories. If I move the classes to the root directory, then i get no errors.
Note: building in another directory has nothing to do with this! I tried building in the root directory, but that did not change anything! :)
The SCons Glob() function is not recursive, so you'll have to add each sub-directory in the source list, as follows:
env.Program(target='exec_test', source=[Glob('build/*.cpp'),
Glob('build/subdir1/*.cpp',
Glob('build/subdir2/*.cpp'])
This should work, or you could consider creating a hierarchical build whereby you create a SConscript script in each sub-directory.