0

I have used boost's dynamic_bitset in my code. I wanted to know if I should include any boost library for the code. I read that we just have to include the boost path in the include directives and boost should work fine ( this link ).

But when I try to compile my code, I get the following error.

boost/dynamic_bitset/dynamic_bitset.hpp: No such file or directory

Here is a simple boost code that makes use of dynamic_bit.

    #include <iostream>
    #include <boost/dynamic_bitset.hpp>
//  Also tried giving the entire boost path
//  #include "/home/user_name/BOOST_CPP/boost_1_50_0/boost_1_50_0/boost/dynamic_bitset.hpp"
    using namespace std;
    int main(int argc, char* argv[])
    {
        cout<<"Welcome to Boost"<<endl;
        boost::dynamic_bitset<> x(10);
        return 0;
    }

[edit] I compiled using g++ boost_hello.cpp Am I missing something? Where I can I find what libraries I should include for compiling boost code.?

PS: I followed Jedf's blog for installing boost libraries at it was successful.

Community
  • 1
  • 1
SyncMaster
  • 9,754
  • 34
  • 94
  • 137

1 Answers1

1

Most likely your include directive is not correct. Your error seems to indicate that the #include <boost/dynamic_bitset.hpp> is working, however, that header does #include "boost/dynamic_bitset/dynamic_bitset.hpp" and that is the header your error is complaining about.

I'm assuming you're using g++, most likely you need something like g++ -I /home/user_name/BOOST_CPP/boost_1_50_0/boost_1_50_0/ in your compilation command line.

If you'll show the command you're using to compile we can probably tell for sure.

oz10
  • 153,307
  • 27
  • 93
  • 128