当我尝试在我的代码中的任何地方声明QPrinter时,我收到以下错误:
Error 1 error LNK2019: unresolved external symbol "__declspec(dllimport)
public: virtual __thiscall QPrinter::~QPrinter(void)" (__imp_??1QPrinter@@UAE@XZ)
referenced in function "private: void __thiscall ezXpns::on_loginButton_clicked(void)" (?
on_loginButton_clicked@ezXpns@@AAEXXZ)
(path)\TestBuild_April3\TestBuild\ezxpns.obj TestBuild
Error 2 error LNK2019: unresolved external symbol "__declspec(dllimport)
public: __thiscall QPrinter::QPrinter(enum QPrinter::PrinterMode)" (__imp_??
0QPrinter@@QAE@W4PrinterMode@0@@Z) referenced in function "private: void __thiscall
ezXpns::on_loginButton_clicked(void)" (?on_loginButton_clicked@ezXpns@@AAEXXZ)
(path)\TestBuild_April3\TestBuild\ezxpns.obj TestBuild
搜索后我发现它暗示,链接器可以找到方法声明,但不能找到方法本身。此外,任何提及QPrinter
似乎都失败了。我认为这可能是因为这种方法在QT5中被折旧,但似乎尚未发布QT打印机通信的新方法。可能是什么问题呢? QPrinter文件中的#IFDEF
预处理器声明?
我的包括:
#include <QtWidgets/QMainWindow>
#include "ui_ezxpns.h"
#include "Vector2D.h"
#include <QtPrintSupport\qprinter.h>
#include <QtPrintSupport\qprintdialog.h>
#include <QtPrintSupport\qtprintsupportglobal.h>
#include <qapplication.h>
答案 0 :(得分:8)