严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK2019 无法解析的外部符号 "__declspec(dllimport) public: __cdecl QPrinter::QPrinter(enum QPrinter::PrinterMode)" (__imp_??0QPrinter@@QEAA@W4PrinterMode@0@@Z),函数 "public: bool __cdecl QCustomPlot::savePdf(class QString const &,int,int,enum QCP::ExportPen,class QString const &,class QString const &)" (?savePdf@QCustomPlot@@QEAA_NAEBVQString@@HHW4ExportPen@QCP@@00@Z) 中引用了该符号 QtWidgetsApplication2 D:\Users\17574\source\repos\QtWidgetsApplication2\QtWidgetsApplication2\qcustomplot.obj 1
时间: 2024-03-07 10:52:04 浏览: 56
这个错误是链接错误,指出在 QCustomPlot 类的 savePdf 函数中引用了 QPrinter 类的构造函数,但链接器无法找到该函数的定义。这通常意味着在链接时没有将 QPrinter 库链接到项目中。
要解决这个错误,你需要确保在项目文件中添加了正确的库文件,并且链接器能够找到这些库文件的位置。具体来说,你需要将 QPrinter 库文件添加到项目文件中,并在项目文件中的链接器设置中指定该库文件的位置。具体的步骤可能因 IDE 而异,你需要查阅对应 IDE 的文档以了解如何添加库文件和设置链接器选项。