VS2010下建立QCustomPlot工程

使用环境:

vs2010(sp1) + Qt5.2.1 + qt-vs-addin-1.2.2 + QCustomPlot 1.2.1

建立步骤:

1. 
前置条件:建立 Qt5 Projects -> Qt Application工程,工程名假设为QPlot;
问题:编译出现“无法打开包括文件:“GLES2/gl2.h”: No such file or directory”;
解决办法:
“项目属性 -> 配置(C): 所有配置”
“项目属性 -> 配置属性 -> C/C++ -> 常规 -> 附加包含目录”里面添加“$(QTDIR)\include\QtANGLE”;

2.
向项目中添加QCustomPlot.h和QCustomPlot.cpp文件,然后通过qtcreator打开qplot.ui文件,添加一个widgets,然后右键点击“提升为...”,提升的类名称:QCustomPlot,头文件:qcustomplot.h,objectName:customPlot;

3.
前置条件:建立 Qt5 Projects -> Qt Application工程,工程名假设为QPlot;
问题:编译出现“找不到QtPrintSupport”;
解决办法:
“项目属性 -> 配置(C): 所有配置”
“项目属性 -> 配置属性 -> C/C++ -> 常规 -> 附加包含目录”里面添加“$(QTDIR)\include\QtPrintSupport”;

4.
前置条件:建立 Qt5 Projects -> Qt Application工程;
问题:编译出现

1>qcustomplot.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: virtual __thiscall QPrinter::~QPrinter(void)" (__imp_??1QPrinter@@UAE@XZ),该符号在函数 "public: bool __thiscall QCustomPlot::savePdf(class QString const &,bool,int,int,class QString const &,class QString const &)" (?savePdf@QCustomPlot@@QAE_NABVQString@@_NHH00@Z) 中被引用
1>qcustomplot.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall QPrinter::setPaperSize(class QSizeF const &,enum QPrinter::Unit)" (__imp_?setPaperSize@QPrinter@@QAEXABVQSizeF@@W4Unit@1@@Z),该符号在函数 "public: bool __thiscall QCustomPlot::savePdf(class QString const &,bool,int,int,class QString const &,class QString const &)" (?savePdf@QCustomPlot@@QAE_NABVQString@@_NHH00@Z) 中被引用
1>qcustomplot.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: class QPrintEngine * __thiscall QPrinter::printEngine(void)const " (__imp_?printEngine@QPrinter@@QBEPAVQPrintEngine@@XZ),该符号在函数 "public: bool __thiscall QCustomPlot::savePdf(class QString const &,bool,int,int,class QString const &,class QString const &)" (?savePdf@QCustomPlot@@QAE_NABVQString@@_NHH00@Z) 中被引用
1>qcustomplot.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall QPrinter::setColorMode(enum QPrinter::ColorMode)" (__imp_?setColorMode@QPrinter@@QAEXW4ColorMode@1@@Z),该符号在函数 "public: bool __thiscall QCustomPlot::savePdf(class QString const &,bool,int,int,class QString const &,class QString const &)" (?savePdf@QCustomPlot@@QAE_NABVQString@@_NHH00@Z) 中被引用
1>qcustomplot.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall QPrinter::setFullPage(bool)" (__imp_?setFullPage@QPrinter@@QAEX_N@Z),该符号在函数 "public: bool __thiscall QCustomPlot::savePdf(class QString const &,bool,int,int,class QString const &,class QString const &)" (?savePdf@QCustomPlot@@QAE_NABVQString@@_NHH00@Z) 中被引用
1>qcustomplot.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall QPrinter::setOutputFormat(enum QPrinter::OutputFormat)" (__imp_?setOutputFormat@QPrinter@@QAEXW4OutputFormat@1@@Z),该符号在函数 "public: bool __thiscall QCustomPlot::savePdf(class QString const &,bool,int,int,class QString const &,class QString const &)" (?savePdf@QCustomPlot@@QAE_NABVQString@@_NHH00@Z) 中被引用
1>qcustomplot.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall QPrinter::setOutputFileName(class QString const &)" (__imp_?setOutputFileName@QPrinter@@QAEXABVQString@@@Z),该符号在函数 "public: bool __thiscall QCustomPlot::savePdf(class QString const &,bool,int,int,class QString const &,class QString const &)" (?savePdf@QCustomPlot@@QAE_NABVQString@@_NHH00@Z) 中被引用
1>qcustomplot.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall QPrinter::QPrinter(enum QPrinter::PrinterMode)" (__imp_??0QPrinter@@QAE@W4PrinterMode@0@@Z),该符号在函数 "public: bool __thiscall QCustomPlot::savePdf(class QString const &,bool,int,int,class QString const &,class QString const &)" (?savePdf@QCustomPlot@@QAE_NABVQString@@_NHH00@Z) 中被引用;

解决办法:

“项目属性 -> 配置(C): Debug”
“项目属性 -> 配置属性 -> 链接器 -> 输入 -> 附加依赖项”里面添加“Qt5PrintSupportd.lib”;

“项目属性 -> 配置(C): Release”
“项目属性 -> 配置属性 -> 链接器 -> 输入 -> 附加依赖项”里面添加“Qt5PrintSupport.lib”;


OK,现在可以编译通过了。

评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值