Вопрос

I'm trying to use Boost's Dynamic_bitset class for a project, and I (believe I) have taken whichever subset of files I needed from the complete library. Now I'm doing an

#include "boost/dynamic_bitset.hpp" inside my manager.cpp file, and when compiling I get this:

In file included from manager.cpp:4:0:
boost/dynamic_bitset.hpp:15:51: fatal error: boost/dynamic_bitset/dynamic_bitset.hpp: No such file or directory

The file ierarchy inside the project folder goes like this:

proj/extras.h
proj/Makefile~
proj/manager.cpp
proj/boost
proj/boost/limits.hpp
proj/boost/dynamic_bitset.hpp
proj/boost/mpl
proj/boost/mpl/if.hpp
proj/boost/mpl/has_xxx.hpp
proj/boost/iterator.hpp
proj/boost/static_assert.hpp
proj/boost/dynamic_bitset
proj/boost/dynamic_bitset/dynamic_bitset.hpp
proj/boost/dynamic_bitset/config.hpp
proj/boost/config
proj/boost/config/select_platform_config.hpp
proj/boost/config/select_compiler_config.hpp
proj/boost/config/user.hpp
proj/boost/config/suffix.hpp
proj/boost/config/select_stdlib_config.hpp
proj/boost/dynamic_bitset_fwd.hpp
proj/boost/config.hpp
proj/boost/type_traits
proj/boost/type_traits/is_same.hpp
proj/boost/type_traits/is_pointer.hpp
proj/boost/type_traits/remove_pointer.hpp
proj/boost/type_traits/remove_const.hpp
proj/boost/type_traits/is_base_and_derived.hpp
proj/boost/type_traits/detail
proj/boost/type_traits/detail/bool_trait_def.hpp
proj/boost/type_traits/detail/yes_no_type.hpp
proj/boost/pending
proj/boost/pending/integer_log2.hpp
proj/boost/detail
proj/boost/detail/limits.hpp
proj/boost/detail/dynamic_bitset.hpp
proj/boost/detail/workaround.hpp
proj/boost/lowest_bit.hpp
proj/Makefile
proj/generator.cpp~
proj/generator.cpp

This same project compiles fine on my university's linux systems(g++ 4.2.4 there but I doubt it matters), but fails to do so (with the above error) on my Ubuntu laptop. Why isn't it finding the file since it evidently exists?

All my includes are as such:

#include <cstdlib>
#include <cstdio>
#include <iostream>
#include "boost/dynamic_bitset.hpp"
#include <cmath>
#include <list>
#include <unistd.h>
#include <sys/sem.h>
#include <sys/shm.h>
#include <errno.h>
#include <wait.h>
#include <time.h>
#include "extras.h"

compilation is done simply with

g++ -o manager manager.c or g++ -Iboost -o manager manager.c

if I want to explicitely include the (local..) folder

Это было полезно?

Решение

-I .

At least if you are compiling in the same directory that contains boost.

You wrote -Iboost and #include "boost/…". So it looks in ./boost if there is a boost subdirectory.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top