Kyle V.
Kyle V.

Reputation: 4792

Boost C++ Libaries in Visual Studio 2017 C++ Project - "Cannot open include file"

I'm trying to add the Boost C++ Libraries to my C++ project created with Visual Studio 2017.

I have followed the instructions here. When that didn't work I tried the advice in this post. Neither solutions worked for me.

What I have done:

When I try to build my project I get this error:

Error C1083 Cannot open include file: 'boost/regex.hpp': No such file or directory

Which points to this line of code in one of my .cpp files:

#include <boost/regex.hpp>

Upvotes: 0

Views: 1006

Answers (3)

Kyle V.
Kyle V.

Reputation: 4792

Found out it was failing because I had included the same .cpp file which has the boost include into my unit test project which did NOT have the Include/Library folders set. The settings in my original question work now.

Upvotes: 0

topoden
topoden

Reputation: 131

Please go to D:\local\boost_1_69_0 folder and see if you have a sub-folder named include in there. If you do, then instead of D:\local\boost_1_69_0 you need to set D:\local\boost_1_69_0\include in Properties > VC++ Directories > Include Directories

In other words, try to find the file you are including on your hard drive. Look at the full path to the file. Compare that full path with the path you added to the list of include directories (Properties > VC++ Directories > Include Directories) concatenated with the relative path you provided just before the filename in your include directive (boost). See if the two are the same.

If that does not help, then make sure you changed list of include directories for the same build configuration as you are attempting to build (if you build Debug, make sure you changed configuration for Debug too). Since VS 2015 IDE stopped making sure the two are selected in sync, which is annoying.

Upvotes: 2

CSThinker_Zhou
CSThinker_Zhou

Reputation: 1

If your files are copied, then you have to compile the regular library.... If the same version of the compiler copies the machine.

Upvotes: 0

Related Questions