基础知识(九)boost+vs2015安装配置

来源:互联网 发布:淘宝新店如何刷销量 编辑:程序博客网 时间:2024/05/17 08:54

在调用boost头文件的时候采用:

<span style="font-size:18px;">#include "boost/program_options.hpp"#include "boost/filesystem.hpp"</span>
结果出现了连接错误:

<span style="font-size:18px;">1>    正在创建库 C:\Users\Administrator\Desktop\facereconstruction\Release\facereconstruction.lib 和对象 C:\Users\Administrator\Desktop\facereconstruction\Release\facereconstruction.exp1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::system_category(void)" (__imp_?system_category@system@boost@@YAABVerror_category@12@XZ)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (__imp_?generic_category@system@boost@@YAABVerror_category@12@XZ)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) void __cdecl boost::filesystem::path_traits::convert(char const *,char const *,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &,class std::codecvt<wchar_t,char,struct _Mbstatet> const &)" (__imp_?convert@path_traits@filesystem@boost@@YAXPBD0AAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@ABV?$codecvt@_WDU_Mbstatet@@@5@@Z)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: class boost::filesystem::path __thiscall boost::filesystem::path::stem(void)const " (__imp_?stem@path@filesystem@boost@@QBE?AV123@XZ)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: class boost::filesystem::path __thiscall boost::filesystem::path::filename(void)const " (__imp_?filename@path@filesystem@boost@@QBE?AV123@XZ)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: static class std::codecvt<wchar_t,char,struct _Mbstatet> const & __cdecl boost::filesystem::path::codecvt(void)" (__imp_?codecvt@path@filesystem@boost@@SAABV?$codecvt@_WDU_Mbstatet@@@std@@XZ)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: class boost::filesystem::path & __thiscall boost::filesystem::path::replace_extension(class boost::filesystem::path const &)" (__imp_?replace_extension@path@filesystem@boost@@QAEAAV123@ABV123@@Z)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall boost::program_options::options_description::options_description(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,unsigned int)" (__imp_??0options_description@program_options@boost@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@II@Z)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: static unsigned int const boost::program_options::options_description::m_default_line_length" (__imp_?m_default_line_length@options_description@program_options@boost@@2IB)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: class boost::program_options::options_description_easy_init & __thiscall boost::program_options::options_description_easy_init::operator()(char const *,class boost::program_options::value_semantic const *,char const *)" (__imp_??Roptions_description_easy_init@program_options@boost@@QAEAAV012@PBDPBVvalue_semantic@12@0@Z)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: class boost::program_options::options_description_easy_init & __thiscall boost::program_options::options_description_easy_init::operator()(char const *,char const *)" (__imp_??Roptions_description_easy_init@program_options@boost@@QAEAAV012@PBD0@Z)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: class boost::program_options::options_description_easy_init __thiscall boost::program_options::options_description::add_options(void)" (__imp_?add_options@options_description@program_options@boost@@QAE?AVoptions_description_easy_init@23@XZ)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall boost::program_options::variables_map::variables_map(void)" (__imp_??0variables_map@program_options@boost@@QAE@XZ)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) void __cdecl boost::program_options::store(class boost::program_options::basic_parsed_options<char> const &,class boost::program_options::variables_map &,bool)" (__imp_?store@program_options@boost@@YAXABV?$basic_parsed_options@D@12@AAVvariables_map@12@_N@Z)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl boost::program_options::operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class boost::program_options::options_description const &)" (__imp_??6program_options@boost@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV23@ABVoptions_description@01@@Z)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) void __cdecl boost::program_options::notify(class boost::program_options::variables_map &)" (__imp_?notify@program_options@boost@@YAXAAVvariables_map@12@@Z)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall boost::program_options::detail::cmdline::cmdline(class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > const &)" (__imp_??0cmdline@detail@program_options@boost@@QAE@ABV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall boost::program_options::detail::cmdline::set_options_description(class boost::program_options::options_description const &)" (__imp_?set_options_description@cmdline@detail@program_options@boost@@QAEXABVoptions_description@34@@Z)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: int __thiscall boost::program_options::detail::cmdline::get_canonical_option_prefix(void)" (__imp_?get_canonical_option_prefix@cmdline@detail@program_options@boost@@QAEHXZ)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: class std::vector<class boost::program_options::basic_option<char>,class std::allocator<class boost::program_options::basic_option<char> > > __thiscall boost::program_options::detail::cmdline::run(void)" (__imp_?run@cmdline@detail@program_options@boost@@QAE?AV?$vector@V?$basic_option@D@program_options@boost@@V?$allocator@V?$basic_option@D@program_options@boost@@@std@@@std@@XZ)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > boost::program_options::arg" (__imp_?arg@program_options@boost@@3V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@A)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl boost::program_options::to_internal(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?to_internal@program_options@boost@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV34@@Z)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) void __cdecl boost::program_options::validators::check_first_occurrence(class boost::any const &)" (__imp_?check_first_occurrence@validators@program_options@boost@@YAXABVany@3@@Z)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall boost::program_options::invalid_option_value::invalid_option_value(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0invalid_option_value@program_options@boost@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) private: virtual void __thiscall boost::program_options::value_semantic_codecvt_helper<char>::parse(class boost::any &,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > const &,bool)const " (__imp_?parse@?$value_semantic_codecvt_helper@D@program_options@boost@@EBEXAAVany@3@ABV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@_N@Z)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: virtual char const * __thiscall boost::program_options::error_with_option_name::what(void)const " (__imp_?what@error_with_option_name@program_options@boost@@UBEPBDXZ)1>facereconstruction.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) protected: virtual void __thiscall boost::program_options::error_with_option_name::substitute_placeholders(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (__imp_?subst</span>

于是添加了#define #undef语句:

<span style="font-size:18px;">#define BOOST_NO_CXX11_SCOPED_ENUMS#include "boost/program_options.hpp"#include <boost/filesystem.hpp>#undef BOOST_NO_CXX11_SCOPED_ENUMS</span>
结果就OK了。

0 0
原创粉丝点击