简体   繁体   中英

what should I do to use boost library for my c++ project in VisualStudio 2013

Hi everyone this is my first time for using boost library in c++ project so I actually dont know what should I do for it.

Here is part of my code that is related with boost :

#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/variant/recursive_wrapper.hpp>
#include <boost/lexical_cast.hpp>

namespace qi = boost::spirit::qi;
namespace phx = boost::phoenix;

struct op_or  {};
struct op_and {};
struct op_not {};

typedef std::string var;
template <typename tag> struct binop;
template <typename tag> struct unop;

I've downloaded boost_1_55 and extract boost/spirit , boost/variant/recursive_wrapper.hpp and boost/lexical_cast.hpp into C:// .After that I've added them into my project by right clicking project and choosing add existing item . Now, If I replace my headers with below

#include "qi.hpp"
#include "phoenix.hpp"
#include "phoenix_operator.hpp"
#include "recursive_wrapper.hpp"
#include "lexical_cast.hpp"

errors on header files are gone but compiler still gives error at :

 #include <boost/variant/recursive_wrapper.hpp>
 #include <boost/lexical_cast.hpp>

lines. It says that " error name followed by :: must be a class or namespace ". So is there anyone to know what should I do ?

An easy way to do this would be to install the latest version of NuGet . Then use the Extension Gallery to search/find/install the boost nuget package .

The added boost.targets will add the automatically add the paths to resolve the libs and headers for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM