问题描述
我已经从源代码下载并构建了 Boost 1.55.我正在尝试使用 Boost-log.在基本情况下 (http://boost-log.sourceforge.net/libs/log/doc/html)/log/tutorial.html#log.tutorial.trivial 它工作正常没有任何问题,但是当我尝试使用一些更高级的功能(像这样 - http://boost-log.sourceforge.net/libs/log/example/doc/tutorial_fmt_stream.cpp )我收到此错误:
i've downloaded and builded Boost 1.55 from source. I'm trying to use Boost-log. In basic case (http://boost-log.sourceforge.net/libs/log/doc/html)/log/tutorial.html#log.tutorial.trivial it's working fine without any problems, but when i try to use some more advanced features(like this - http://boost-log.sourceforge.net/libs/log/example/doc/tutorial_fmt_stream.cpp ) i'm getting this error:
main.obj:错误 LNK2019:未解析的外部符号void __cdeclboost::filesystem::path_traits::convert(char const *,char const*,类 std::basic_string,类 std::allocator>&,class std::codecvt const &)" (?convert@path_traits@filesystem@boost@@YAXPBD0AAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@ABV?$codecvt@GDH@5@@Z)在函数void __cdecl"中引用boost::filesystem::path_traits::dispatch,class std::allocator > >(classstd::basic_string, 类std::allocator > const &,class std::basic_string,classstd::allocator > &,class std::codecvt const &)"(??$dispatch@V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@path_traits@filesystem@boost@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@4@ABV?$codecvt@GDH@4@@Z)
1>main.obj:错误 LNK2019:未解析的外部符号void __cdeclboost::log::v2s_mt_nt5::aux::code_convert(unsigned short const*,unsigned int,class std::basic_string,class std::allocator > &,classstd::locale const &)"(?code_convert@aux@v2s_mt_nt5@log@boost@@YAXPBGIAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABVlocale@6@@Z)在函数private: void __thiscall"中引用boost::log::v2s_mt_nt5::basic_formatting_ostream,class std::allocator>::aligned_write(unsigned short const *,__int64)" (??$aligned_write@G@?$basic_formatting_ostream@DU?$char_traits@D@std@@V?$allocator@D@2@@v2s_mt_nt5@log@boost@@AAEXPBG_J@Z)
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl boost::log::v2s_mt_nt5::aux::code_convert(unsigned short const *,unsigned int,class std::basic_string,class std::allocator > &,class std::locale const &)" (?code_convert@aux@v2s_mt_nt5@log@boost@@YAXPBGIAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABVlocale@6@@Z) referenced in function "private: void __thiscall boost::log::v2s_mt_nt5::basic_formatting_ostream,class std::allocator> ::aligned_write(unsigned short const *,__int64)" (??$aligned_write@G@?$basic_formatting_ostream@DU?$char_traits@D@std@@V?$allocator@D@2@@v2s_mt_nt5@log@boost@@AAEXPBG_J@Z)
1>main.obj : error LNK2019: 未解析的外部符号 "public: static类 std::codecvt const &__cdeclboost::filesystem::path::codecvt(void)"(?codecvt@path@filesystem@boost@@SAABV?$codecvt@GDH@std@@XZ)在函数public: __thiscall"中引用boost::filesystem::path::path(char const (&)[14],void*)" (??$?0$$BY0O@$$CBD@path@filesystem@boost@@QAE@AAY0O@$$CBDPAX@Z)
1>main.obj : error LNK2019: unresolved external symbol "public: static class std::codecvt const & __cdecl boost::filesystem::path::codecvt(void)" (?codecvt@path@filesystem@boost@@SAABV?$codecvt@GDH@std@@XZ) referenced in function "public: __thiscall boost::filesystem::path::path(char const (&)[14],void *)" (??$?0$$BY0O@$$CBD@path@filesystem@boost@@QAE@AAY0O@$$CBDPAX@Z)
所以基本上它无法在 .lib 文件中找到函数 convert(...)、code_convert(...) 和 codecvt(...).
So basically it can't find functions convert(...), code_convert(...) and codecvt(...) in .lib files.
我已经尝试将所有发布库(在构建 boost 时制作的 .lib 文件)添加到附加库"中,通常我认为 Visual Studio 可以找到所有库,但在库中找不到这些函数.有什么想法可以解决这个问题吗?
I've already tried to add all release libraries (.lib files made while building boost) to "additional libraries" and generally i think that visual studio find all libraries, but can't find those functions in libraries. Any ideas how can i fix this?
我已经使用 Visual Studio 2010 (msvc10.0)、32 位、发布和调试从源代码构建了 Boost 1.55.我正在使用 Windows 7 x64.
I've build Boost 1.55 from source using visual studio 2010 (msvc10.0), 32 bit, release and debug. I'm working on windows 7 x64.
推荐答案
我遇到了同样的问题,我可以通过更改 VisualStudio 2010 上的项目属性之一来解决它.
I had the same problem and I could fix it by changing one of the Project properties on VisualStudio 2010.
前往:
属性页 -> 配置属性 -> C/C++ -> 语言 -> 将 WChar_t 视为内置类型:
并将属性设置为:
是 (/Zc:wchar_t)
希望对你有帮助:)
保重,
这篇关于Boost-log 链接器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!