C++ Boost日志链接器错误
我已经从源代码下载并构建了Boost 1.55。我正在尝试使用Boost日志。在基本情况下(它工作正常,没有任何问题,但当我尝试使用一些更高级的功能(如此-)时,我遇到以下错误: main.obj:错误LNK2019:未解析的外部符号“void\uu cdecl” boost::filesystem::path_traits::convert(char const*,char const *,类std::basic_字符串,类std::分配器> &,class std::codecvt const&“(?convert@path_traits@filesystem@boost@@YAXPBD0AAV?$basic_string@GU?$char_traits@G@性病病毒$allocator@G@2@@std@@ABV$codecvt@GDH@5@@Z) 在函数“void\uuu cdecl”中引用 boost::filesystem::path_traits::dispatch,类std::allocator>>(类 std::基本_字符串,类 std::allocator>const&,类std::basic_字符串,类 std::分配器>&,类std::codecvt const&“ (??$dispatch@V?$basic_string@GU?$char_traits@G@性病病毒$allocator@G@2@@std@@@path_traits@filesystem@boost@@YAXABV?$basic_string@DU?$char_traits@D@性病病毒$allocator@D@2@@std@@AAV?$basic_string@GU?$char_traits@G@性病病毒$allocator@G@2@@4@ABV?$codecvt@GDH@4@@Z) 1> main.obj:错误LNK2019:未解析的外部符号“void\uu cdecl” boost::log::v2s\u mt\u nt5::aux::code\u convert(无符号短常量) *,无符号整数,类std::basic_字符串,类std::分配器>&,类 std::locale const&) (?代码_convert@aux@v2s_mt_nt5@log@boost@@YAXPBGIAAV?$basic_string@DU?$char_traits@D@性病病毒$allocator@D@2@@std@@ABVlocale@6@@Z) 在函数“private:void\u thiscall”中引用 boost::log::v2s\u mt\u nt5::基本格式\u ostream,类std::分配器> ::aligned_write(无符号短常量*,_int64)”(??$aligned_write@G@?$basic\u格式_ostream@DU?$char_traits@D@性病病毒$allocator@D@2@@v2s\u mt_nt5@log@boost@@AAEXPBG_J@Z) 1> main.obj:错误LNK2019:未解析的外部符号“公共:静态” 类std::codecvt const和\uuu cdecl boost::filesystem::path::codecvt(void)” (?codecvt@path@filesystem@boost@@萨博$codecvt@GDH@标准@@XZ) 在函数“public:\ u thiscall”中引用 boost::filesystem::path::path(char const(&)[14],void *)“(?$?0$$BY0O@$$CBD@path@filesystem@boost@@QAE@AAY0O@$$CBDPAX@Z) 所以基本上它在.lib文件中找不到convert(…)、code_convert(…)和codevt(…)函数 我已经尝试将所有版本库(.lib文件在构建boost时生成)添加到“附加库”中,通常我认为visual studio可以找到所有库,但在库中找不到这些函数。有什么办法可以解决这个问题吗C++ Boost日志链接器错误,c++,visual-studio-2010,boost,linker,boost-log,C++,Visual Studio 2010,Boost,Linker,Boost Log,我已经从源代码下载并构建了Boost 1.55。我正在尝试使用Boost日志。在基本情况下(它工作正常,没有任何问题,但当我尝试使用一些更高级的功能(如此-)时,我遇到以下错误: main.obj:错误LNK2019:未解析的外部符号“void\uu cdecl” boost::filesystem::path_traits::convert(char const*,char const *,类std::basic_字符串,类std::分配器> &,class std::codecvt cons
我使用visual studio 2010(msvc10.0)32位版本和调试从源代码构建了Boost 1.55。我正在使用windows 7 x64。我遇到了同样的问题,我可以通过更改VisualStudio 2010上的一个项目属性来修复它 转到: 属性页->配置属性->C/C++->语言->将WChar\u t视为内置类型: 并将属性设置为: 是(/Zc:wchar\t) 我希望它也能对您有所帮助:)
注意,MSVC自动链接增强了libs,因此您不必显式链接它们。然而,
无符号短码
看起来可疑。检查您是否使用“/Zc:wchar\u t”选项编译所有内容,即“wchar\u t是本机类型”。您是否在项目中使用编译源代码时使用的boost.log设置(读取:#defines
)相同?在我们的例子中,我们必须确保在包括BOOST.LOG头的项目中使用BOOST\u LOG\u NO\u线程
,否则我们会得到不同的链接器错误,尽管同样恼人。