当前位置: 技术问答>linux和unix
请教Qt编译的问题
来源: 互联网 发布时间:2015-12-25
本文导语: 我用的是redhat9.0,自带的qt-3.1,刚开始使用,想那个简单程序先运行一下, 当我使用qtdesigner编辑好程序后,运行出现错误,请各位指教。hehe.pro是工程的名字 [lili@localhost lili]$ qmake hehe.pro [lili@localhost lili]$ make g++...
我用的是redhat9.0,自带的qt-3.1,刚开始使用,想那个简单程序先运行一下,
当我使用qtdesigner编辑好程序后,运行出现错误,请各位指教。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
#include
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();
}
QTDIR=usr/lib/qt-3.1
PATH=$QTDIR/bin:$PATH
LD_LIBRARY_PATH=$QTDIR/bin:$LD_LIBRARY_PATH
export QTDIR PATH LD_LIBRARY_PATH
下面是我所检查安装包的情况:
[root@localhost root]# rpm -qa | grep qt
qt-devel-3.1.1-6
qt2-2.3.1-13
qt2-Xt-2.3.1-13
qt-3.1.1-6
qtcups-2.0-15
qt-PostgreSQL-3.1.1-6
qt2-designer-2.3.1-13
qt-designer-3.1.1-6
licq-qt-1.2.3-5
qt-MySQL-3.1.1-6
qt2-devel-2.3.1-13
qtcups-devel-2.0-15
qt-ODBC-3.1.1-6
qt-Xt-3.1.1-6
qt2-static-2.3.1-13
请各位指教!谢谢
当我使用qtdesigner编辑好程序后,运行出现错误,请各位指教。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
#include
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();
}
QTDIR=usr/lib/qt-3.1
PATH=$QTDIR/bin:$PATH
LD_LIBRARY_PATH=$QTDIR/bin:$LD_LIBRARY_PATH
export QTDIR PATH LD_LIBRARY_PATH
下面是我所检查安装包的情况:
[root@localhost root]# rpm -qa | grep qt
qt-devel-3.1.1-6
qt2-2.3.1-13
qt2-Xt-2.3.1-13
qt-3.1.1-6
qtcups-2.0-15
qt-PostgreSQL-3.1.1-6
qt2-designer-2.3.1-13
qt-designer-3.1.1-6
licq-qt-1.2.3-5
qt-MySQL-3.1.1-6
qt2-devel-2.3.1-13
qtcups-devel-2.0-15
qt-ODBC-3.1.1-6
qt-Xt-3.1.1-6
qt2-static-2.3.1-13
请各位指教!谢谢
|
编译步骤不对把?
你试试一下三步:
qmake -project
qmake
make
你试试一下三步:
qmake -project
qmake
make