自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

講解在Linux下配置QT 學習之路

移動開發(fā)
講解在Linux下配置QT 學習之路是本文要介紹的內(nèi)容,介紹了各種工具包等一些內(nèi)容。先來看內(nèi)容。

本文介紹的是講解在Linux下配置QT 學習之路,我們首先來看內(nèi)容。在CentOS下配置QT:通過yum search qt,得知源上可以安裝的QT軟件列表如下(有很多QT組件可以選擇安裝):

qt.i386 : Qt GUI 工具包的共享庫。

qt-MySQL.i386 : 用于 Qt 的 SQL 類別的 MySQL 驅(qū)動程序。

qt-ODBC.i386 : 用于 Qt 的 SQL 類別的 ODBC 驅(qū)動程序。

qt-PostgreSQL.i386 : 用于 Qt 的 SQL 類別的 PostgreSQL 驅(qū)動程序。

qt-config.i386 : 為使用 Qt 的程序提供的圖形化配置工具。

qt-designer.i386 : Qt GUI 工具包的界面設(shè)計程序 (IDE)

  1. qt-devel.i386 : Development files for the Qt GUI toolkit.  
  2. qt-devel-docs.i386 : Documentation for the Qt GUI toolkit.  
  3. wpa_supplicant-gui.i386 : Graphical User Interface for wpa_supplicant 

PyQt.i386 : Qt 的 Python 綁定

PyQt-devel.i386 : 要建構(gòu)基于 Qt 的其它綁定所需的文件

PyQt-examples.i386 : PyQt 的樣例

  1. avahi-qt3.i386 : Qt3 libraries for avahi // avahi是什么東西?  
  2.  
  3. avahi-qt3-devel.i386 : Libraries and header files for avahi Qt3 development  
  4. pinentry-qt.i386 : Passphrase/PIN entry dialog based on Qt  
  5. qt4.i386 : The shared library for the Qt GUI toolkit  
  6. qt4-devel.i386 : Development files for the Qt GUI toolkit  
  7. qt4-doc.i386 : API documentation, demos and example programs for qt4  
  8. qt4-mysql.i386 : MySQL drivers for Qt's SQL classes  
  9. qt4-odbc.i386 : ODBC drivers for Qt's SQL classes  
  10. qt4-postgresql.i386 : PostgreSQL drivers for Qt's SQL classes  
  11. qt4-sqlite.i386 : SQLite drivers for Qt's SQL classes  
  12. qtnx.i386 : QT4 based FreeNX Client 

scim-qtimm.i386 : Qt 的 SCIM 輸入法模塊 // 這個是SCIM模塊,用Qt實現(xiàn)的吧?

  1. scribus.i386 : DeskTop Publishing application written in Qt  
  2. sip.i386 : SIP - Python/C++ 綁定生成器. 

通過rpm命令查詢已經(jīng)安裝的Qt軟件:

  1. [root@Tomato ~]# rpm -qa | grep qt  
  2. qt-3.3.6-23.el5  
  3. scim-qtimm-0.9.4-5  
  4. avahi-qt3-0.6.16-6.el5 // Qt3和Qt4可以同時共存嗎? 

Linux上編譯居然因為環(huán)境變量,而報錯:

  1. QMAKESPEC has not been set, so configuration cannot be deduced.  
  2. Error processing project file: /root/qt/qt.pro 

在腳本里加入該環(huán)境變量,這個錯誤已經(jīng)消失:

  1. [root@localhost qt]# ls  
  2. hello.cpp  
  3. [root@localhost qt]# qmake -project  
  4. [root@localhost qt]# ls  
  5. hello.cpp qt.pro  
  6. [root@localhost qt]# qmake  
  7. [root@localhost qt]# ls  
  8. hello.cpp Makefile qt.pro 

Make報如下錯誤:

  1. [root@localhost qt]# make  
  2. g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB 
  3. -I/work/program/dsk/qt-everywhere-opensource-src-4.6.1/mkspecs/linux-g++ -I. 
  4. -I/work/program/qtdevelop/include/QtCore -I/work/program/qtdevelop/include/QtGui 
  5. -I/work/program/qtdevelop/include -I. -I. -o hello.o hello.cpp  
  6. hello.cpp:1:24: 錯誤:QApplication:沒有那個文件或目錄  
  7. hello.cpp:2:18: 錯誤:QLabel:沒有那個文件或目錄  
  8. hello.cpp: In function ‘int main(int, char**)’:  
  9. hello.cpp:6: 錯誤:‘QApplication’ 在此作用域中尚未聲明  
  10. hello.cpp:6: 錯誤:expected `;' before ‘app’  
  11. hello.cpp:7: 錯誤:‘QLabel’ 在此作用域中尚未聲明  
  12. hello.cpp:7: 錯誤:‘label’ 在此作用域中尚未聲明  
  13. hello.cpp:7: 錯誤:expected type-specifier before ‘QLabel’  
  14. hello.cpp:7: 錯誤:expected `;' before ‘QLabel’  
  15. hello.cpp:9: 錯誤:‘app’ 在此作用域中尚未聲明  
  16. hello.cpp: At global scope:  
  17. hello.cpp:4: 警告:未使用的參數(shù) ‘argc’  
  18. hello.cpp:4: 警告:未使用的參數(shù) ‘argv’  
  19. make: *** [hello.o] 錯誤 1 

生成的Makefile有些問題:

  1. CC            = gcc 
  2. CXX           = g++  
  3. DEFINES       = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB  
  4. CFLAGS        = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)  
  5. CXXFLAGS      = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)  
  6. INCPATH       = -I/work/program/dsk/qt-everywhere-opensource-src-4.6.1/mkspecs/l  
  7. inux-g++ -I. -I/work/program/qtdevelop/include/QtCore -I/work/program/qtdevelop/  
  8. include/QtGui -I/work/program/qtdevelop/include -I. -I. // 這個路徑是怎么生成的?.  
  9. LINK          = g++  
  10. LFLAGS        = -Wl,-O1  
  11. LIBS          = $(SUBLIBS) -L/work/program/qtdevelop/lib -lQtGui -lQtCore -lpth  
  12. read 

簡單文件運行出錯:

  1. [root@localhost c++]# ./a.out  
  2. -bash: ./a.out: cannot execute binary file // 剛開始出這個錯是什么原因啊?重新編譯后就正常了。。。  
  3. [root@localhost c++]# file a.out  
  4. a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, 
  5. dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped 

修改Makefile之后,文件編譯成功,但是運行仍然是報錯的:

  1. [root@localhost qt]# make  
  2. g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB 
  3. -I/work/program/dsk/qt-everywhere-opensource-src-4.6.1/mkspecs/linux-g++ -I. 
  4. -I/work/program/dsk/qt-everywhere-opensource-src-4.6.1/include/QtCore 
  5. -I/work/program/dsk/qt-everywhere-opensource-src-4.6.1/include/QtGui 
  6. -I/work/program/dsk/qt-everywhere-opensource-src-4.6.1/include -I. -I. -o hello.o hello.cpp  
  7. g++ -Wl,-O1 -o qt hello.o    -L/work/program/dsk/qt-everywhere-opensource-src-4.6.1/lib -lQtGui -lQtCore -lpthread  
  8. [root@localhost qt]# ls  
  9. hello.cpp hello.o Makefile qt qt.pro  
  10. [root@localhost qt]# ./qt  
  11. ./qt: error while loading shared libraries: libQtGui.so.4: cannot open shared object file: No such file or directory 

100216 缺少這個動態(tài)鏈接庫,如何辦?: 可以直接在路徑里加上嗎?

  1. [root@localhost qt]# find /work/program/dsk/qt-everywhere-opensource-src-4.6.1/ | grep libQtGui.so.4  
  2. /work/program/dsk/qt-everywhere-opensource-src-4.6.1/lib/libQtGui.so.4.6.1  
  3. /work/program/dsk/qt-everywhere-opensource-src-4.6.1/lib/libQtGui.so.4.6.1.debug  
  4. /work/program/dsk/qt-everywhere-opensource-src-4.6.1/lib/libQtGui.so.4.6  
  5. /work/program/dsk/qt-everywhere-opensource-src-4.6.1/lib/libQtGui.so.4 

ld文件配置:

  1. /etc/ld.so.conf  
  2. include ld.so.conf.d/*.conf // 里面只有一行配置,表示去ld.so.conf.d目錄中尋找配置信息。  
  3. /etc/ld.so.conf.d/qt-i386.conf 這里的配置信息為:usr/lib/qt-3.3/lib,指向老的qt配置。  
  4. /etc/ld.so.conf.d/mysql-i386.conf // 怎么只有兩個ld配置文件?  
  5. usr/lib/mysql 

這個目錄下還有很多配置文件:

  1. [root@localhost mkspecs]# pwd  
  2. /work/program/dsk/qt-everywhere-opensource-src-4.6.1/mkspecs 

Qt庫文件的實際位置:

  1. [root@localhost lib]# du -sh  
  2. 425M    .  
  3. [root@localhost lib]# pwd  
  4. /work/program/dsk/qt-everywhere-opensource-src-4.6.1/lib. 

設(shè)置完ld路徑后,運行成功第一個Qt程序。。。:

現(xiàn)在的ld.so.conf.d下的qt配置內(nèi)容如下:

  1. #/usr/lib/qt-3.3/lib // 之后需要運行l(wèi)dconfig命令。  
  2. /work/program/dsk/qt-everywhere-opensource-src-4.6.1/lib 

講解在Linux下配置QT 學習之路

ld設(shè)置后,基于Qt的應(yīng)用啟動不了。。。:

把/usr/lib/qt-3.3/lib注釋掉,只配置下面的選項(運行基于qt-3.3的應(yīng)用程序出錯,在界面是跳出報錯窗口)。

  1. /work/program/dsk/qt-everywhere-opensource-src-4.6.1/lib 

在命令行報出的錯誤則有些不同:

  1. [root@localhost qt]# ksnapshot  
  2. ksnapshot: error while loading shared libraries: libqt-mt.so.3: cannot open shared object file: No such file or directory 

講解在Linux下配置QT 學習之路

小結(jié):關(guān)于講解在Linux下配置QT 學習之路的內(nèi)容介紹完了希望本文對你有所幫助!

責任編輯:zhaolei 來源: 互聯(lián)網(wǎng)
相關(guān)推薦

2011-07-05 13:32:45

QT Mysql 驅(qū)動

2011-06-17 10:19:11

Qt QWidge QSetting

2011-06-17 09:58:26

Qt Chapter QObject

2011-03-03 10:49:37

Linux配置Proftpd

2011-06-10 10:31:57

QT mysql linux

2011-06-28 16:56:41

Linux Qt creator

2011-04-25 15:14:38

LinuxQtOpenCV

2011-07-02 13:42:24

Qt 移植

2011-06-08 14:06:42

linux SDK Qt

2011-06-15 10:49:26

Qt QTableItem

2010-05-24 08:51:13

Linux下SVN服務(wù)

2011-06-28 09:20:41

Qt Qt 4.3.2 Visual Stu

2011-06-17 11:00:18

Qt Linux Ubuntu

2011-07-25 13:05:37

Objective-C 委托

2011-06-15 18:38:17

Linux Qt Symbian

2012-11-05 13:33:08

LinuxHBase

2009-07-17 14:26:40

在Linux下配置Jy

2011-07-02 14:03:12

Linux Qt

2009-10-27 08:57:50

linux殺死進程

2010-09-29 14:45:04

配置DHCP
點贊
收藏

51CTO技術(shù)棧公眾號