在不使用lib库编译daytime client程序时,按照《Boost程序库完全开发指南》添加的定义

#define BOOST_REGEX_NO_LIB
#define BOOST_DATE_TIME_SOURCE
#define BOOST_SYSTEM_NO_LIB

编译时会产生:

error LNK2019: 无法解析的外部符号 "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ),该符号在函数 "public: __thiscall boost::system::error_code::error_code(void)" (??0error_code@system@boost@@QAE@XZ) 中被引用

error LNK2019: 无法解析的外部符号 "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ),该符号在函数 "void __cdecl boost::system::`dynamic initializer for 'posix_category''(void)" (??__Eposix_category@system@boost@@YAXXZ) 中被引用

解决方法:

在boost的system库的error_code.hpp源代码中发现
#define BOOST_ERROR_CODE_HEADER_ONLY

可以解决这个问题。

添加此定义以后编译成功

相关文章:

  • 2021-10-07
  • 2022-12-23
  • 2022-02-14
  • 2021-09-29
  • 2022-12-23
  • 2021-07-22
  • 2022-12-23
  • 2021-07-07
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-14
  • 2022-12-23
相关资源
相似解决方案