qt4运行错误

软件和网站开发以及相关技术探讨
回复
xxhanhan
帖子: 1
注册时间: 2015-08-23 0:53
系统: ubuntu kylin14.04

qt4运行错误

#1

帖子 xxhanhan » 2015-08-23 1:18

qt4的安装方式:

代码: 全选

sudo apt-get install libqt4-dev libqt4-debug libqt4-gui libqt4-sql qt4-dev-tools qt4-doc qt4-designer qt4-qtconfig
其中libqt4-debug 不存在,看网上教程改成了另外一个。

测试的程序就是简单的hello.cpp 肯定是没有错误的

代码: 全选

$ qmake-qt4 -project
$ qmake-qt4
$ make
$ ./qt4hello
这样运行没有问题,但是如果是这样:

代码: 全选

qmake -project
qmake
make
就报错

代码: 全选

g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I. -I. -I/usr/include/qt5 -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I. -o hello.o hello.cpp
hello.cpp:1:25: fatal error: QApplication: 没有那个文件或目录
 #include <QApplication> 
                         ^
compilation terminated.
里面居然全都是qt5blabla的...但是我·····好像····没有安装过qt5。
而且主要是qtcreator 也无法运行,也是一样的问题,求问要怎么解决
操作系统是kylin14.04
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: qt4运行错误

#2

帖子 poloshiao » 2015-08-24 5:03

viewtopic.php?p=3140232#p3140232
Selecting between Qt4 and Qt5 before compile
psv1988
帖子: 80
注册时间: 2009-02-17 13:48

Re: qt4运行错误

#3

帖子 psv1988 » 2015-08-27 17:34

ubuntu12好像是安装qt4的 如果是14就是qt5了 也有可能是软件自动升级造成的 我安装的时候就是先运行你那行命令 然后单独下载个qt4的creator安装上来 不然在14上通过命令安装基本上都是qt5
回复