chmod 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 -lfreetype
collect2: 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.0
collect2: 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
此时即可解决,,,,,,
编译、运行正常,,,