簡體   English   中英

在Visual Studio 2013中為我的C ++項目使用Boost庫我應該怎么做

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

大家好,這是我第一次在c ++項目中使用boost庫,所以我實際上不知道該怎么做。

這是與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;

我已經下載了boost_1_55,並將boost/spiritboost/variant/recursive_wrapper.hppboost/lexical_cast.hpp提取到C://中。之后,通過右鍵單擊項目並選擇添加現有項,將它們添加到我的項目中。 現在,如果我將標題替換為以下內容

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

頭文件上的錯誤已消失,但編譯器仍在以下位置給出錯誤:

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

線。 它說“ 錯誤名稱后跟::必須是類或名稱空間 ”。 那么,有誰知道我該怎么辦?

一種簡單的方法是安裝最新版本的NuGet 然后使用擴展庫搜索/查找/安裝boost nuget軟件包

添加的boost.targets將添加自動添加的路徑來為您解析庫和標頭。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM