尝试构建Boost.Log示例时发生链接错误

Linking error while trying to build Boost.Log example

本文关键字:链接 错误 构建 Boost Log      更新时间:2023-10-16

我已经成功地在Windows 7上为VS 2010构建了Boost.Log库。当我尝试运行最简单的例子时,我的程序找不到Boost.System和Boost.Filesystem的符号,我得到了"未定义的外部符号"错误。我已经通过手动将libboost_filesystem-vc100-mt-gd-1_48.liblibboost_system-vc100-mt-gd-1_48.lib包含在项目中来解决这个问题。

然而,现在我遇到了另一个问题:在尝试为Boost.Log构建"basic_usage"示例时,我得到了错误

error LNK2019: unresolved external symbol "private: void __thiscall boost::log_mt_nt5::sinks::basic_text_file_backend<char>::construct(class boost::filesystem3::path const &,int,unsigned __int64,class boost::function0<bool> const &,bool)"

我该如何解决这个问题?

我找到了解决方案!

原因是我用Boost.Filesystem v2构建了Boost.Log,而它本应该用v3构建。我已经正确地重建了它,现在它工作得很好。