- 論壇徽章:
- 0
|
我用的是redhat9.0,自帶的qt-3.1,剛開始使用,想那個簡單程序先運(yùn)行一下,
當(dāng)我使用qtdesigner編輯好程序后,運(yùn)行出現(xiàn)錯誤,請各位指教。hehe.pro是工程的名字
[lili@localhost lili]$ qmake hehe.pro
[lili@localhost lili]$ make
g++ -c -pipe -Wall -W -O2 -march=i386 -mcpu=i686 -g -DGLX_GLXEXT_LEGACY -fno-use-cxa-atexit -fno-exceptions -DQT_NO_DEBUG -I/usr/lib/qt-3.1/mkspecs/default -I. -I/usr/lib/qt-3.1/include -I.ui/ -I.moc/ -o .obj/main.o main.cpp
main.cpp: In function `int main(int, char**)':
main.cpp:8: `QPushButtton' undeclared (first use this function)
main.cpp:8: (Each undeclared identifier is reported only once for each function
it appears in.)
main.cpp:8: parse error before `(' token
main.cpp:9: `hellobtn' undeclared (first use this function)
make: *** [.obj/main.o] Error
下面是我的程序:
#include <qapplication.h>
#include <qpushbutton.h>
int main( int argc,char **argv)
{
QApplication a(argc,argv);
QPushButton hellobtn("hello world!",0);
hellobtn.resize(100,20);
a.setMainWidget(&hellobtn);
hellobtn.show();
return a.exec();
}
所設(shè)的環(huán)境變量如下:
QTDIR=usr/lib/qt-3.1
PATH=$QTDIR/bin PATH
LD_LIBRARY_PATH=$QTDIR/bin LD_LIBRARY_PATH
export QTDIR PATH LD_LIBRARY_PATH |
|