Qt程序编辑
-
- 帖子: 433
- 注册时间: 2009-07-06 14:26
- comfanter
- 帖子: 190
- 注册时间: 2009-05-02 14:51
Re: Qt程序编辑
这句话?但Qt很多库vim上都是没有的

先用vim编辑,再用qmake -project,qmake,make
用cmake或autoconf,automake等亦可
-
- 帖子: 433
- 注册时间: 2009-07-06 14:26
Re: Qt程序编辑
我是新手,对你说的qmake什么的不明白,能否给个简单的例子comfanter 写了:这句话?但Qt很多库vim上都是没有的![]()
先用vim编辑,再用qmake -project,qmake,make
用cmake或autoconf,automake等亦可
比如hello
然后告诉我下具体的步骤
生命只不过是上帝借你一用的资本!
- comfanter
- 帖子: 190
- 注册时间: 2009-05-02 14:51
Re: Qt程序编辑
多看看qt自带的文档
-
- 帖子: 433
- 注册时间: 2009-07-06 14:26
Re: Qt程序编辑
代码: 全选
wangjun@wj-dt:~/workspace/hellomake$ ls
main.cpp
wangjun@wj-dt:~/workspace/hellomake$ cat main.cpp
#include <QApplication>
#include <QLabel>
int main(int argc, char *argv[])
{
QApplication app(argc,argv); //创建对象
QLabel *label=new QLabel("hello zhangrong!"); //QLabel对象,小控件
label->show();
return app.exec(); //让程序进入æM -&
wangjun@wj-dt:~/workspace/hellomake$
代码: 全选
wangjun@wj-dt:~/workspace/hellomake$ qmake -project
wangjun@wj-dt:~/workspace/hellomake$ ls
hellomake.pro main.cpp
wangjun@wj-dt:~/workspace/hellomake$ qmake
wangjun@wj-dt:~/workspace/hellomake$ ls
hellomake.pro main.cpp Makefile
wangjun@wj-dt:~/workspace/hellomake$ make
g++ -c -pipe -g -Wall -W -O2 -D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/share/qt3/mkspecs/default -I. -I. -I/usr/include/qt3 -o main.o main.cpp
main.cpp:1:24: error: QApplication: 没有该文件或目录
main.cpp:2:18: error: QLabel: 没有该文件或目录
main.cpp: In function ‘int main(int, char**)’:
main.cpp:6: error: ‘QApplication’ was not declared in this scope
main.cpp:6: error: expected ‘;’ before ‘app’
main.cpp:7: error: ‘QLabel’ was not declared in this scope
main.cpp:7: error: ‘label’ was not declared in this scope
main.cpp:7: error: expected type-specifier before ‘QLabel’
main.cpp:7: error: expected ‘;’ before ‘QLabel’
main.cpp:9: error: ‘app’ was not declared in this scope
main.cpp:9: error: expected ‘}’ at end of input
main.cpp: At global scope:
main.cpp:4: warning: unused parameter ‘argc’
main.cpp:4: warning: unused parameter ‘argv’
make: *** [main.o] 错误 1
wangjun@wj-dt:~/workspace/hellomake$
或者是其他地方错了
生命只不过是上帝借你一用的资本!
- comfanter
- 帖子: 190
- 注册时间: 2009-05-02 14:51
Re: Qt程序编辑
你是怎么安装的,试试sudo apt-get install libqt4-dev
以下是我安装过的一些qt库:
ii libqt4-assista 4.5.3really4.5 Qt 4 assistant module
ii libqt4-dbus 4.5.3really4.5 Qt 4 D-Bus module
ii libqt4-designe 4.5.3really4.5 Qt 4 designer module
ii libqt4-dev 4.5.3really4.5 Qt 4 development files
ii libqt4-help 4.5.3really4.5 Qt 4 help module
ii libqt4-network 4.5.3really4.5 Qt 4 network module
ii libqt4-opengl 4.5.3really4.5 Qt 4 OpenGL module
ii libqt4-opengl- 4.5.3really4.5 Qt 4 OpenGL library development files
ii libqt4-phonon 4.5.3really4.5 Phonon multimedia framework for Qt 4
ii libqt4-qt3supp 4.5.3really4.5 Qt 3 compatibility library for Qt 4
ii libqt4-ruby1.8 4:4.3.2-0ubunt Qt 4 bindings for Ruby
ii libqt4-script 4.5.3really4.5 Qt 4 script module
ii libqt4-scriptt 4.5.3really4.5 Qt 4 script tools module
ii libqt4-sql 4.5.3really4.5 Qt 4 SQL module
ii libqt4-sql-mys 4.5.3really4.5 Qt 4 MySQL database driver
ii libqt4-sql-sql 4.5.3really4.5 Qt 4 SQLite 3 database driver
ii libqt4-svg 4.5.3really4.5 Qt 4 SVG module
ii libqt4-test 4.5.3really4.5 Qt 4 test module
ii libqt4-webkit 4.5.3really4.5 Qt 4 WebKit module
ii libqt4-xml 4.5.3really4.5 Qt 4 XML module
ii libqt4-xmlpatt 4.5.3really4.5 Qt 4 XML patterns module
ii libqtcore4 4.5.3really4.5 Qt 4 core module
ii libqtgui4 4.5.3really4.5 Qt 4 GUI module
ii libqtscript4-c 0.1.0-3 Qt Script bindings for the Qt 4 Core library
ii libqtscript4-g 0.1.0-3 Qt Script bindings for the Qt 4 Gui library
ii libqtscript4-n 0.1.0-3 Qt Script bindings for the Qt 4 Network libr
ii libqtscript4-s 0.1.0-3 Qt Script bindings for the Qt 4 SQL library
ii libqtscript4-u 0.1.0-3 Qt Script bindings for the Qt 4 UiTools libr
ii libqtscript4-x 0.1.0-3 Qt Script bindings for the Qt 4 XML library
以下是我安装过的一些qt库:
ii libqt4-assista 4.5.3really4.5 Qt 4 assistant module
ii libqt4-dbus 4.5.3really4.5 Qt 4 D-Bus module
ii libqt4-designe 4.5.3really4.5 Qt 4 designer module
ii libqt4-dev 4.5.3really4.5 Qt 4 development files
ii libqt4-help 4.5.3really4.5 Qt 4 help module
ii libqt4-network 4.5.3really4.5 Qt 4 network module
ii libqt4-opengl 4.5.3really4.5 Qt 4 OpenGL module
ii libqt4-opengl- 4.5.3really4.5 Qt 4 OpenGL library development files
ii libqt4-phonon 4.5.3really4.5 Phonon multimedia framework for Qt 4
ii libqt4-qt3supp 4.5.3really4.5 Qt 3 compatibility library for Qt 4
ii libqt4-ruby1.8 4:4.3.2-0ubunt Qt 4 bindings for Ruby
ii libqt4-script 4.5.3really4.5 Qt 4 script module
ii libqt4-scriptt 4.5.3really4.5 Qt 4 script tools module
ii libqt4-sql 4.5.3really4.5 Qt 4 SQL module
ii libqt4-sql-mys 4.5.3really4.5 Qt 4 MySQL database driver
ii libqt4-sql-sql 4.5.3really4.5 Qt 4 SQLite 3 database driver
ii libqt4-svg 4.5.3really4.5 Qt 4 SVG module
ii libqt4-test 4.5.3really4.5 Qt 4 test module
ii libqt4-webkit 4.5.3really4.5 Qt 4 WebKit module
ii libqt4-xml 4.5.3really4.5 Qt 4 XML module
ii libqt4-xmlpatt 4.5.3really4.5 Qt 4 XML patterns module
ii libqtcore4 4.5.3really4.5 Qt 4 core module
ii libqtgui4 4.5.3really4.5 Qt 4 GUI module
ii libqtscript4-c 0.1.0-3 Qt Script bindings for the Qt 4 Core library
ii libqtscript4-g 0.1.0-3 Qt Script bindings for the Qt 4 Gui library
ii libqtscript4-n 0.1.0-3 Qt Script bindings for the Qt 4 Network libr
ii libqtscript4-s 0.1.0-3 Qt Script bindings for the Qt 4 SQL library
ii libqtscript4-u 0.1.0-3 Qt Script bindings for the Qt 4 UiTools libr
ii libqtscript4-x 0.1.0-3 Qt Script bindings for the Qt 4 XML library
-
- 帖子: 433
- 注册时间: 2009-07-06 14:26
- comfanter
- 帖子: 190
- 注册时间: 2009-05-02 14:51
Re: Qt程序编辑
代码: 全选
comfanter@kubuntu:/usr/include/qt4$ ls
Qt QtDBus QtNetwork QtSql QtWebKit
Qt3Support QtDesigner QtOpenGL QtSvg QtXml
QtAssistant QtGui QtScript QtTest QtXmlPatterns
QtCore QtHelp QtScriptTools QtUiTools
-
- 帖子: 433
- 注册时间: 2009-07-06 14:26
-
- 帖子: 11
- 注册时间: 2008-04-02 11:39
Re: Qt程序编辑
4楼用的什么vim配色方案和字体哦,看上去很漂亮的说。comfanter 写了:多看看qt自带的文档
能共享哈否?
- comfanter
- 帖子: 190
- 注册时间: 2009-05-02 14:51
Re: Qt程序编辑
clxme 写了:4楼用的什么vim配色方案和字体哦,看上去很漂亮的说。comfanter 写了:多看看qt自带的文档
能共享哈否?
代码: 全选
System->Konsole->Settings->Edit Current Profile->Appearance->Dark Pastels
-
- 帖子: 433
- 注册时间: 2009-07-06 14:26
Re: Qt程序编辑
comfanter 写了:下载SDK安装的话所有文件都在~/里面,编译时系统会到/usr/include里面去寻找头文件,所以找不到,建议还是安装源里qt,虽然官网的比较新代码: 全选
comfanter@kubuntu:/usr/include/qt4$ ls Qt QtDBus QtNetwork QtSql QtWebKit Qt3Support QtDesigner QtOpenGL QtSvg QtXml QtAssistant QtGui QtScript QtTest QtXmlPatterns QtCore QtHelp QtScriptTools QtUiTools
已经把用bin文件安装的QT卸载了
然后从新立德装好了
但是在编译的时候还是会提示和以前一样的错误
代码: 全选
wangjun@wj-dt:~/workspace/hellomake$ qmake -project;qmake;make
g++ -c -pipe -g -Wall -W -O2 -D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/share/qt3/mkspecs/default -I. -I. -I/usr/include/qt3 -o main.o main.cpp
main.cpp:1:24: error: QApplication: 没有该文件或目录
main.cpp:2:18: error: QLabel: 没有该文件或目录
main.cpp: In function ‘int main(int, char**)’:
main.cpp:6: error: ‘QApplication’ was not declared in this scope
main.cpp:6: error: expected ‘;’ before ‘app’
main.cpp:7: error: ‘QLabel’ was not declared in this scope
main.cpp:7: error: ‘label’ was not declared in this scope
main.cpp:7: error: expected type-specifier before ‘QLabel’
main.cpp:7: error: expected ‘;’ before ‘QLabel’
main.cpp:9: error: ‘app’ was not declared in this scope
main.cpp:9: error: expected ‘}’ at end of input
main.cpp: At global scope:
main.cpp:4: warning: unused parameter ‘argc’
main.cpp:4: warning: unused parameter ‘argv’
make: *** [main.o] 错误 1
代码: 全选
wangjun@wj-dt:~/workspace/hellomake$ sudo apt-get install libqt4-dev
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
libqt4-dev 已经是最新的版本了。
libqt4-dev 被设置为手动安装。
共升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 8 个软件未被升级。
代码: 全选
wangjun@wj-dt:/usr/include/qt4$ ls
Qt QtDBus QtNetwork QtSql QtWebKit
Qt3Support QtDesigner QtOpenGL QtSvg QtXml
QtAssistant QtGui QtScript QtTest QtXmlPatterns
QtCore QtHelp QtScriptTools QtUiTools
生命只不过是上帝借你一用的资本!
-
- 帖子: 3182
- 注册时间: 2006-03-10 15:10
- 来自: xi'an China
- 联系:
Re: Qt程序编辑
用 qmake-qt4 替代 qmake
或者让 qmake 指向 qmake-qt4
或者卸掉你安装的Qt3
或者让 qmake 指向 qmake-qt4
或者卸掉你安装的Qt3
- comfanter
- 帖子: 190
- 注册时间: 2009-05-02 14:51
Re: Qt程序编辑
楼上正解,卸载qt3
-
- 帖子: 433
- 注册时间: 2009-07-06 14:26