G:\redhat_copy\00纯净版
Qt_SDK_Lin32_offline_v1_1_1_en.run
fontconfig-2.8.0.tar.gz
freetype-2.3.4.tar.gz
libstdc++.so.6.0.10
———————————————QT4 SDK安装———————————————
(1)安装QT4_SDK前,更新libstdc++.so.6。
#cd/home/
#./Qt_SDK_Lin32_offline_v1_1_1_en.run
./Qt_SDK_Lin32_offline_v1_1_1_en.run:/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' notfound (required by ./Qt_SDK_Lin32_offline_v1_1_1_en.run)
[root@localhosthome]# strings /usr/lib/libstdc++.so.6|grep GLIBC
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBC_2.3
GLIBC_2.0
GLIBC_2.3.2
GLIBC_2.4
GLIBC_2.1
GLIBC_2.1.3
GLIBC_2.2
GLIBCXX_FORCE_NEW
把libstdc++.so.6.0.13这个资源放到/usr/lib文件夹下。删除/usr/lib/libstdc++.so.6。
在输入命令ln -s/usr/lib/libstdc++.so.6.0.13 /usr/lib/libstdc++.so.6。问题解决
可以输入strings/usr/lib/libstdc++.so.6 | grep GLIBC查看GLIBCXX_XXX是否在其中
[root@localhostlib]# cp /mnt/hgfs/Apple/libstdc++.so.6.0.10 /usr/lib/
[root@localhostlib]# find libstdc*
libstdc++-3-libc6.2-2-2.10.0.so
libstdc++-libc6.2-2.so.3
libstdc++.so.5
libstdc++.so.5.0.7
libstdc++.so.6
libstdc++.so.6.0.10
libstdc++.so.6.0.8
[root@localhostlib]# rm libstdc++.so.6
[root@localhostlib]# ln –s /usr/lib/libstdc++.so.6.0.10 /usr/lib/libstdc++.so.6
[root@localhostlib]# ll libstdc*
-rwxr-xr-x1 root root 259532 2006-08-22 libstdc++-3-libc6.2-2-2.10.0.so
lrwxrwxrwx1 root root 31 11-12 06:44libstdc++-libc6.2-2.so.3 -> libstdc++-3-libc6.2-2-2.10.0.so
lrwxrwxrwx1 root root 18 11-12 06:44libstdc++.so.5 -> libstdc++.so.5.0.7
-rwxr-xr-x1 root root 733456 2006-08-21 libstdc++.so.5.0.7
lrwxrwxrwx1 root root 28 11-16 03:32 libstdc++.so.6-> /usr/lib/libstdc++.so.6.0.10
-rwxr-xr-x1 root root 950392 11-16 03:27 libstdc++.so.6.0.10
-rwxr-xr-x1 root root 936908 2009-05-15 libstdc++.so.6.0.8
(2)安装QT4_SDK。
#./Qt_SDK_Lin32_offline_v1_1_1_en.run
please specify the folder where Qt SDK willbe intstalled。
/opt/QtSDK
—————————————QT4_SDK的目录结构/opt/QtSDK———————————
(1)
[root@localhost readme]# ls/opt/QtSDK/QtCreator/bin/
assistant designer linguist qmlpuppet Qt qtcreator qtcreator_process_stub qtpromaker QtWebKit
即有:
/opt/QtSDK/QtCreator/bin/designer
/opt/QtSDK/QtCreator/bin/assistant
/opt/QtSDK/QtCreator/bin/qtcreator
(2)simulator
[root@localhost bin]# ls/opt/QtSDK/Simulator/Qt/gcc/
bin/ imports/ lib/ plugins/ translations/
doc/ include/ mkspecs/ qtc-qmldump/
[root@localhost bin]# ls/opt/QtSDK/Simulator/Qt/gcc/bin/
lconvert qcollectiongenerator qdbusxml2cpp qmake xmlpatterns lrelease qdbus
qdoc3 qmlviewer xmlpatternsvalidator lupdate qdbuscpp2xml qhelpconverter
rcc moc qdbusviewer qhelpgenerator uic
/opt/QtSDK/Simulator/Qt/gcc/bin/qmake
/opt/QtSDK/Simulator/Qt/gcc/bin/moc
/opt/QtSDK/Simulator/Qt/gcc/bin/uic
[root@localhost bin]# ls/opt/QtSDK/Simulator/Qt/gcc/include/
[root@localhost bin]# ls/opt/QtSDK/Simulator/Qt/gcc/lib/
(3)x86Desktop
[root@localhost bin]# ls/opt/QtSDK/Desktop/Qt/473/gcc/
bin imports include lib mkspecs phrasebooks plugins q3porting.xml qtc-qmldump translations
[root@localhost bin]# ls/opt/QtSDK/Desktop/Qt/473/gcc/bin
assistant lupdate qcollectiongenerator qdbusviewer qhelpconverter qmlviewer qttracereplay uic3 lconvert moc qdbus qdbusxml2cpp qhelpgenerator qt3to4 rcc xmlpatterns lrelease pixeltool qdbuscpp2xml qdoc3 qmake qtconfig uic xmlpatternsvalidator
即有:
/opt/QtSDK/Desktop/Qt/473/gcc/bin/assistant
/opt/QtSDK/Desktop/Qt/473/gcc/bin/moc
/opt/QtSDK/Desktop/Qt/473/gcc/bin/qmake
/opt/QtSDK/Desktop/Qt/473/gcc/bin/uic
在Desktop上使用:
/opt/QtSDK/Desktop/Qt/473/gcc/bin/moc
/opt/QtSDK/Desktop/Qt/473/gcc/bin/qmake
/opt/QtSDK/Desktop/Qt/473/gcc/bin/uic
/opt/QtSDK/QtCreator/bin/designer
/opt/QtSDK/QtCreator/bin/assistant
/opt/QtSDK/QtCreator/bin/qtcreator
/opt/QtSDK/Desktop/Qt/473/gcc/include
/opt/QtSDK/Desktop/Qt/473/gcc/lib
—————————————用QT4_SDK的命令———————————
#/opt/QtSDK/Desktop/Qt/473/gcc/bin/qmake –project
#/opt/QtSDK/Desktop/Qt/473/gcc/bin/qmake
#make
#make install
(1) 用QT4_SDK的命令前,更新fontconfig-2.8.0.tar.gz和freetype-2.3.4.tar.gz。
[root@localhosthello]# vim hello.cpp
#include <QtGui/QApplication>
#include <QtGui/QWidget>
#include <QtGui/QLabel>
#include <QtCore/QTextCodec>
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QTextCodec::setCodecForTr(QTextCodec::codecForName("gb18030"));
QWidget* pWidget = new QWidget;
QLabel label(pWidget);
label.setText(QObject::tr("同一个世界,同一个梦想!"));
pWidget->show();
return app.exec();
}
[root@localhosthello]# ls
hello.cpp
[root@localhosthello]# /opt/QtSDK/Desktop/Qt/473/gcc/bin/qmake -project
[root@localhosthello]# ls
hello.cpp hello.pro
[root@localhosthello]# /opt/QtSDK/Desktop/Qt/473/gcc/bin/qmake
[root@localhosthello]# ls
hello.cpp hello.pro Makefile
[root@localhosthello]# make
g++ -c -pipe -O2-Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB-I/opt/QtSDK/Desktop/Qt/473/gcc/mkspecs/default -I.-I/opt/QtSDK/Desktop/Qt/473/gcc/include/QtCore-I/opt/QtSDK/Desktop/Qt/473/gcc/include/QtGui -I/opt/QtSDK/Desktop/Qt/473/gcc/include-I. -I. -o hello.o hello.cpp
g++ -Wl,-O1-Wl,-rpath,/opt/QtSDK/Desktop/Qt/473/gcc/lib -o hello hello.o -L/opt/QtSDK/Desktop/Qt/473/gcc/lib -lQtGui-lQtCore -lpthread
/opt/QtSDK/Desktop/Qt/473/gcc/lib/libQtGui.so:undefined reference to `FcFreeTypeQueryFace'
/opt/QtSDK/Desktop/Qt/473/gcc/lib/libQtGui.so:undefined reference to `FT_Library_SetLcdFilter'
collect2: ld 返回 1
make: *** [hello] 错误 1
fontconfig-2.8.0.tar.gz对应 FT_Library_SetLcdFilte
freetype-2.3.4.tar.gz 对应 FcFreeTypeQueryFace
[root@localhosthome]# cp /mnt/hgfs/Apple/fontconfig-2.8.0.tar.gz /home
[root@localhosthome]# cp /mnt/hgfs/Apple/freetype-2.3.4.tar.gz /home
把它拷贝进系统中,然后依次执行如下命令:
tar-zxvf fontconfig-2.8.0.tar.gz -C /mytmp (解压到mytmp文件夹中)
./configure--sysconfdir=/etc --prefix=/usr --mandir=/usr/share/man
makeinstall
makeclean (清除无用文件)
然后重新启动系统之后再次运行程序就没有问题了。
[root@localhosthome]#tar -zxvf fontconfig-2.8.0.tar.gz-C ./
[root@localhosthome]#tar -zxvf freetype-2.3.4.tar.gz-C ./
[root@localhosthome]#cd fontconfig-2.8.0
[root@localhost fontconfig-2.8.0]#./configure--sysconfdir=/etc --prefix=/usr --mandir=/usr/share/man
[root@localhostfontconfig-2.8.0]#make
[root@localhostfontconfig-2.8.0]#make install
同理:
[root@localhosthome]#cd freetype-2.3.4
[root@localhost freetype-2.3.4]#./configure--sysconfdir=/etc --prefix=/usr --mandir=/usr/share/man
[root@localhostfreetype-2.3.4]#make
[root@localhostfreetype-2.3.4]#make install
[root@localhosthello]# make clean
rm -f hello.o
rm -f *~ core*.core
[root@localhosthello]# make
g++ -c -pipe -O2-Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB-I/opt/QtSDK/Desktop/Qt/473/gcc/mkspecs/default -I.-I/opt/QtSDK/Desktop/Qt/473/gcc/include/QtCore-I/opt/QtSDK/Desktop/Qt/473/gcc/include/QtGui -I/opt/QtSDK/Desktop/Qt/473/gcc/include-I. -I. -o hello.o hello.cpp
g++ -Wl,-O1-Wl,-rpath,/opt/QtSDK/Desktop/Qt/473/gcc/lib -o hello hello.o -L/opt/QtSDK/Desktop/Qt/473/gcc/lib -lQtGui-lQtCore –lpthread
[root@localhosthello]# ./hello
问题:"同一个世界,同一个梦想!" 变成乱码。
方法一:
vim下UTF-8改为gb18030(终端——设置字符编码),再输入"同一个世界,同一个梦想!"
理论上可行,可是gb18030模式下使用vim会不正常。(该方法不行)
方法二:qtcreator
方法三:source insight