安装:
http://get.qtsoftware.com/qtsdk/qt-sdk-linux-x86-opensource-2009.02.bin下载地址:
http://www.qtsoftware.com/downloads/sdk-linux-x11-32bit-cppchmod u+x qt-sdk-linux-x86-opensource-2009.02.bin
./qt-sdk-linux-x86-opensource-2009.02.bin
接着出现安装,,,,,
安装结束,,,,,
运行如下代码时
#include <QApplication>
#include <QLabel>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel *label = new QLabel("Hello Qt!");
label->show();
return app.exec();
}
Qt Creator 编译运行,,,
Starting: /usr/bin/make -w
make: Entering directory `/home/sun/Desktop/Myprojects/hello'
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../qt/qt/mkspecs/linux-g++ -I. -I../../../qt/qt/include/QtCore -I../../../qt/qt/include/QtGui -I../../../qt/qt/include -I. -I. -I. -o hello.o hello.cpp
g++ -Wl,-O1 -Wl,-rpath,/home/sun/qt/qt/lib -o hello hello.o -L/home/sun/qt/qt/lib -lQtGui -L/home/sun/qt/qt/lib -L/usr/X11R6/lib -pthread -lfreetype -lgobject-2.0 -lSM -lICE -pthread -pthread -lXrender -lfontconfig -lXext -lX11 -lQtCore -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -ldl -lpthread
/usr/bin/ld: cannot find -lfreetypecollect2: ld returned 1 exit status
make: *** [hello] Error 1
make: Leaving directory `/home/sun/Desktop/Myprojects/hello'
Exited with code 2.
Error while building project hello
When executing build step 'Make'
解决 /usr/bin/ld: cannot find -lfreetype
安装 libfreetype-dev
(用synaptic Package Manager 选 libfreetype6 和libfreetype6-dev )编译时出现:
/usr/bin/ld: cannot find -lgobject-2.0collect2: ld returned 1 exit status
make: *** [hello] Error 1
make: Leaving directory `/home/sun/Desktop/pro/hello'
Exited with code 2.
Error while building project hello
When executing build step 'Make'
安装:
gob2 2.0.15-1
libsm6
libsm-dev
libxrender-dev
fontconfig-dev
libxetx-dev 此时即可解决,,,,,,
编译、运行正常,,,
安装文件参考原英文帖子:
http://stackoverflow.com/questions/646232/usr-bin-ld-cannot-find-lfreetype-qt/865945说明:
昨晚折腾到1点多,还未解决问题,,,,
刚关机,想到了环境变量未设置,开机设置,问题仍在,,,,,
早上6点就爬起来,继续,,,,
多谢gvim兄的帮助,,,,,,
问题原帖子:
http://www.qtcn.org/bbs/read.php?tid=18439