Reputation: 7756
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.
Upvotes: 0
Views: 1708
Reputation: 12727
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.
$ find /home/acm/local/include -type f
/home/acm/local/include/boost/not_a_boost_header.hpp
library.cpp:
#include <boost/not_a_boost_header.hpp>
void foo() { }
program.cpp:
#include <boost/not_a_boost_header.hpp>
int main() { return 0; }
SConstruct:
env1 = Environment(CPPPATH = '/home/acm/local/include')
env1.Library('MyLib', 'library.cpp')
env2 = Environment(CPPPATH = '/home/acm/local/include')
env2.Program('program.cpp')
Build results:
$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o library.o -c -I/home/acm/local/include library.cpp
ar rc libMyLib.a library.o
ranlib libMyLib.a
g++ -o program.o -c -I/home/acm/local/include program.cpp
g++ -o program program.o
scons: done building targets.
Can you post the complete SCons output?
Upvotes: 1