[英]Use of BOOST property_tree / iostreams / filesystem / foreach - results with a Link Error
I try to build a project, utilizing boost/property_tree
with Boost xml_parser
, upon a std::wstring
full_path.我尝试在std::wstring
full_path 上使用boost/property_tree
和 Boost xml_parser
构建一个项目。 But I get a link error (See below).但我收到一个链接错误(见下文)。
#include <filesystem> // C++17
#include <codecvt> // C++11
#include <boost/property_tree/xml_parser.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/foreach.hpp>
#include <boost/iostreams/device/file_descriptor.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/filesystem.hpp>
#include <iostream>
void CMainFrame::OnGroup(UINT nID)
{
// Prepare wstring group-name:
std::string group_name = m_id_to_string[nID]; //AG: PATCH
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
std::wstring group_name_w = converter.from_bytes(group_name);
using boost::property_tree::ptree;
// Populate tree structure pt:
ptree pt;
boost::filesystem::wpath full_path = CEngine::Instance().GetGroupDirectory() + group_name_w;
boost::iostreams::file_descriptor_source fs(full_path);
boost::iostreams::stream<boost::iostreams::file_descriptor_source> fsstream(fs);
read_xml(fsstream, pt);
BOOST_FOREACH(ptree::value_type const& v, pt.get_child("Group"))
{
unsigned int DeviceId, GridId, MonitorId;
if (v.first == "Item")
{
DeviceId = v.second.get<unsigned int>("DeviceId");
GridId = v.second.get<unsigned int>("GridId");
MonitorId = v.second.get<unsigned int>("MonitorId");
}
};
}
I get this error:我收到此错误:
1>------ Build started: Project: BFC, Configuration: Debug x64 ------
1>MainFrm.cpp
1>LINK : fatal error LNK1104: cannot open file 'libboost_iostreams-vc141-mt-gd-x64-1_67.lib'
1>Done building project "BFC.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Any idea?任何的想法?
Some libraries of boost are not header only and so those need to be built.一些 boost 库不仅仅是头文件,因此需要构建它们。 See https://www.boost.org/doc/libs/1_67_0/libs/iostreams/doc/installation.html请参阅https://www.boost.org/doc/libs/1_67_0/libs/iostreams/doc/installation.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.