编译静态库遇到的 LNK2019 报错

您所在的位置:网站首页 boost库编译缺少头文件 编译静态库遇到的 LNK2019 报错

编译静态库遇到的 LNK2019 报错

2023-05-30 00:08| 来源: 网络整理| 查看: 265

前文提到了 CMake 学习

文末基本涵盖了我遇到的编译问题,但是在得到一个编译好的 .lib 文件后,还需要放到项目中引用成功后才算真正的完成静态库的编译

嗯,我之所以说这些是因为我在项目中链接静态库时出现了 LNK2019 经典错误

错误如下:

Libraryd.lib(at_exit.obj) : error LNK2019: unresolved external symbol "void __cdecl logging::MakeCheckOpValueString(class std::basic_ostream *,class base::AtExitManager *) Libraryd.lib(rand_util.obj) : error LNK2019: unresolved external symbol "void __cdecl logging::MakeCheckOpValueString(class std::basic_ostream *,double)" Libraryd.lib(rand_util.obj) : error LNK2019: unresolved external symbol "void __cdecl logging::MakeCheckOpValueString(class std::basic_ostream *,unsigned __int64)" Libraryd.lib(file_path.obj) : error LNK2019: unresolved external symbol "void __cdecl logging::MakeCheckOpValueString(class std::basic_ostream *,wchar_t const *)"

我们先看 .h 和 .cc 文件中对 MakeCheckOpValueString 的声明和定义吧

.h 文件

// Provide an overload for functions and function pointers. Function pointers // don't implicitly convert to void* but do implicitly convert to bool, so // without this function pointers are always printed as 1 or 0. (MSVC isn't // standards-conforming here and converts function pointers to regular // pointers, so this is a no-op for MSVC.) template inline typename std::enable_if::type MakeCheckOpValueString(std::ostream* os, const T& v) { (*os)


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3