I have boost installed under /home/username/local/include. I want to compile a library with this set under CPPPATH.
SConstruct:
env = Environment(CPPPATH = '/home/username/local/include')
env.Library('MyLib', 'library.cpp')
library.cpp:
#include <boost/shared_ptr.hpp> // library.cpp:1:32: error: boost/shared_ptr.hpp: No such file or directory
void foo() { }
However, when I run scons, it gives the error error: boost/shared_ptr.hpp: No such file or directory.
Doing the same thing for a program works just fine.
SConstruct:
env = Environment(CPPPATH = '/home/username/local/include')
env.Program('program.cpp')
program.cpp:
#include <boost/shared_ptr.hpp> // works
int main() { return 0; }
What am I missing here?
EDIT
Here is the output:
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o library.o -c -I/home/m/local/include library.cpp
library.cpp:1:32: error: boost/shared_ptr.hpp: No such file or directory
scons: *** [library.o] Error 1
scons: building terminated because of errors.
I can’t reproduce your error on my system. Everything you have there looks right to me.
I created a faked out boost include setup, and used a different filename so it wouldn’t accidentally reach into my real boost includes in /usr. I’m using SCons 2.0.1.
library.cpp:
program.cpp:
SConstruct:
Build results:
Can you post the complete SCons output?