I am trying to use the dynamic bitset provided by boost libraries. Downloaded the file boost_1_55_0.tar.bz2 and extracted it into a folder named boost. In this folder I have put my source code file with the #include directive #include <boost/dynamic_bitset.hpp>
, when I compile the source code, the compiler returns "No such file or directory". Where to place the source code?
Asked
Active
Viewed 90 times
0

Mohamed Ahmed
- 457
- 1
- 7
- 25
-
Well if your source is also in the boost directory (which is not a good idea), then your include should be #include "dynamic_bitset.hpp", – OldProgrammer Apr 08 '14 at 01:25
-
What is the good idea then? – Mohamed Ahmed Apr 08 '14 at 01:28
-
Put your code in a separate folder, then add the boost directory to your compiler's INCLUDE path (compiler-dependant) – OldProgrammer Apr 08 '14 at 01:29
-
Well, I am using g++ on Ubuntu. May you show me how to add the boost directory to the compiler's INCLUDE path? – Mohamed Ahmed Apr 08 '14 at 01:31
-
1If you bother to search SO, there are many entries, and on google also. http://stackoverflow.com/questions/12654013/how-to-make-g-search-for-header-files-in-a-specific-directory – OldProgrammer Apr 08 '14 at 01:35
-
Thank you! But why do capitalize "SO"? – Mohamed Ahmed Apr 08 '14 at 01:37
-
Another resource is [the boost documentation](http://www.boost.org/doc/libs/1_55_0/libs/dynamic_bitset/dynamic_bitset.html#examples) that shows examples for `dynamic_bitset`. The best way to get help here is to clearly show what you've tried, what you expected and what actually happened. – Edward Apr 08 '14 at 01:48
1 Answers
0
I managed to compile the program by putting the source code file in the the same directory that boost is in, and compiling using the command formula:
g++ -I /your/source/root /your/source/root/A/code.cpp
As mentioned in the How to make g++ search for header files in a specific directory?

Community
- 1
- 1

Mohamed Ahmed
- 457
- 1
- 7
- 25
-
1This is bad. If you are on a UNIX like system, use your package manager to install Boost. After that you can just put your source whereever you want and compile it without adding any flags. – pmr Apr 09 '14 at 18:16
-