查看完整版本: [-- windows刚安装的QT5.4.2运行不了书中的例子 --]

QTCN开发网 -> 《C++ GUI Qt 4编程》(第2版)专栏 -> windows刚安装的QT5.4.2运行不了书中的例子 [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

donjun 2015-11-14 14:07

windows刚安装的QT5.4.2运行不了书中的例子

刚安装的QT5.4.2,运行例程正常,整么运行书中第一个例子

D:\QT_test\qt-book-examples\qt-book\chap01\hello\hello.cpp:1: error: QApplication: No such file or directory
#include <QApplication>
                        
难道QT4到QT5跨度这么大吗,这应该是很基础的类吧,怎么都变了?还是搞错了,请指点

donjun 2015-11-14 15:11
经过多番百度找到原因:
  工程文件里加上  QT += core gui widgets  这个兼容性也差的太多了吧
头文件加上
#include <QtWidgets/QApplication>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QSlider>
#include <QtWidgets/QSpinBox>


查看完整版本: [-- windows刚安装的QT5.4.2运行不了书中的例子 --] [-- top --]



Powered by phpwind v8.7 Code ©2003-2011 phpwind
Gzip disabled