George
George

Reputation: 87

I completely cannot include boost headers

I needed a boost's "filesystem" so I downloaded and successfully build the whole boost. Its directory is C:\Program Files\Boost\boost_1_60_0\boost

Then I created a vs project and specified include directories, additional include directories and library directories. A couple of ways. Tried to add it to the system path, created a system variable bouth with setx an manually.

C:\Program Files\Boost\boost_1_60_0; $(BOOST_ROOT); 
"evaluetes to" C:\Program Files\Boost\boost_1_60_0 

But I still can't include and use anything.

#include <boost\filesystem> // error
#include "boost//filesystem.hpp" //error
#include <boost\filesystem.hpp> //error
#include "C://Program Files//Boost//boost_1_60_0//boost" //error

// those are working but still useless due to includes in the "filesystem.hpp"
#include "C:\Program Files\Boost\boost_1_60_0\boost\filesystem.hpp"
#include <C:\Program Files/Boost//boost_1_60_0\boost\filesystem.hpp>


#include <filesystem> // does not give an error, but following 
using namespace boost::filesystem; //still does

By the way, I worked with boost in this same ide a couple of weeks ago. And things were ok, not sure how I got it working back then though.

What could possibly be wrong? I'm kind of lost.

Upvotes: 2

Views: 2788

Answers (1)

J-Mik
J-Mik

Reputation: 896

Assuming you already built the library. You need to right-click on your Visual Studio project and click Properties.

As you can see on those pictures, specify the Additional Include Directories to C:\Program Files\Boost\boost_1_60_0 and Additional Library Directories to C:\Program Files\Boost\boost_1_60_0\stage\lib:

enter image description here

enter image description here

Then click OK

To include the boost filesystem write:

#include <boost/filesystem.hpp>

Let me know if you're still having problems after this.

Upvotes: 1

Related Questions