我使用QT 5.1.1和Qt Creator 2.8.1
我想用打印机:
QPrinter printer(QPrinter::HighResolution);
QPrintDialog printdialog(&printer,this);
if (printdialog.exec() == QDialog::Accepted)
{
QTextDocument doc;
doc.setHtml(s);
doc.print(&printer);
}
我收到了这个错误:
DictionaryWidget.obj:-1:错误:LNK2019:未解析的外部符号“__declspec(dllimport)public:_ thiscall QPrinter :: QPrinter(enum QPrinter :: PrinterMode)”( _imp _ ?? 0QPrinter @@ QAE @ W4PrinterMode @ 0 @@ Z)在函数“private:void __thiscall DictionaryWidget :: on_pbPrint_clicked(void)”中引用(?on_pbPrint_clicked @ DictionaryWidget @@ AAEXXZ)
在.pro文件中我有:
QT += core gui xml printsupport
在QT Creator LIBPATH中构建环境,如下所示:
libpath: C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Windows\Microsoft.NET\Framework64\v3.5;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\LIB\amd64;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\ATLMFC\LIB\amd64;C:\Program Files (x86)\Windows Kits\8.0\References\CommonConfiguration\Neutral;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\Microsoft.VCLibs\11.0\References\CommonConfiguration\neutral;C:\Qt\5.1.1\msvc2012\lib;
在文件夹C:\ Qt \ _5.1.1 \ msvc2012 \ lib文件中找到Qt5PrintSupport.lib
我该怎么做才能使项目有效?