Question

I'm trying to compile a project, but SCons can't find glm/glm.hpp... This is my SConstruct:

VariantDir('build', '.')
env=Environment(CPPPATH=['.'], CPPDEFINES=[], LIBS=[], CXXFLAGS="-std=c++0x")
env.Program(target='exec_test', source=[Glob('build/*.cpp'), Glob('build/*.hpp')])

and this is the output:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build
g++ -o build/game.o -c -std=c++0x -I. build/game.cpp
g++ -o build/main.o -c -std=c++0x -I. build/main.cpp
g++ -o exec_test build/game.o build/main.o build/game.hpp
build/game.hpp:15:23: fatal error: glm/glm.hpp: No such file or directory
 #include <glm/glm.hpp>
                       ^
compilation terminated.
scons: *** [exec_test] Error 1
scons: building terminated because of errors.

main.cpp , game.cpp and game.hpp are in current directory, and glm.hpp is in glm/glm.hpp (from the current directory)

What am i doing wrong?

Edit:

I've done some editing, and i realized a very strange thing: I get the error only in game.hpp! I also tried to remove the glm include line, and i got a warning that some code is only available in c++11. That means that none of scons building arguments are used for game.hpp. I also tried including glm in main.cpp and game.cpp and it compiled without errors or warnings. I think that not about the game.hpp file, it's about scons not building .hpp files with the arguments in the SConstruct.

Était-ce utile?

La solution

You should not be including header files in the source list when compiling. Consider changing your call to Program() as follows:

env.Program(target='exec_test', source=[Glob('build/*.cpp')])
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top