• 11536阅读
  • 1回复

【提问】我是新手,刚刚装完qt-4.1.1,但试图编译一个demo时报错,请帮忙! [复制链接]

上一主题 下一主题
离线712100
 

只看楼主 倒序阅读 楼主  发表于: 2006-03-05
我是新手,刚刚装完qt-4.1.1,但试图编译一个demo时报错,请帮忙!

jun@linux:/usr/local/Trolltech/Qt-4.1.1/demos/deform> qmake -project
jun@linux:/usr/local/Trolltech/Qt-4.1.1/demos/deform> qmake
jun@linux:/usr/local/Trolltech/Qt-4.1.1/demos/deform> make all
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../mkspecs/linux-g++ -I. -I../../include/QtCore -I../../include/QtGui -I../../include -I. -I. -I. -o main.o main.cpp
In file included from main.cpp:24:
pathdeform.h:27:27: error: arthurwidgets.h: 没有那个文件或目录
pathdeform.h:34: error: expected class-name before ‘{’ token
pathdeform.h:47: error: ‘QMouseEvent’ has not been declared
pathdeform.h:48: error: ‘QMouseEvent’ has not been declared
pathdeform.h:49: error: ‘QMouseEvent’ has not been declared
pathdeform.h:50: error: ‘QTimerEvent’ has not been declared
pathdeform.h:85: error: field ‘m_lens_pixmap’ has incomplete type
pathdeform.h:86: error: field ‘m_lens_image’ has incomplete type
pathdeform.h:34: warning: ‘class PathDeformRenderer’ has virtual functions but non-virtual destructor
pathdeform.h: In member function ‘int PathDeformRenderer::radius() const’:
pathdeform.h:55: warning: converting to ‘int’ from ‘const double’
pathdeform.h: In member function ‘int PathDeformRenderer::intensity() const’:
pathdeform.h:57: warning: converting to ‘int’ from ‘const double’
pathdeform.h: At global scope:
pathdeform.h:98: error: invalid use of undefined type ‘struct QWidget’
../../include/QtGui/qwindowdefs.h:35: error: forward declaration of ‘struct QWidget’
main.cpp: In function ‘int main(int, char**)’:
main.cpp:35: error: expected type-specifier before ‘ArthurStyle’
main.cpp:35: error: cannot convert ‘int*’ to ‘QStyle*’ in initialization
main.cpp:35: error: expected ‘,’ or ‘;’ before ‘ArthurStyle’
main.cpp:36: error: ‘class PathDeformWidget’ has no member named ‘setStyle’
main.cpp:38: error: cannot convert ‘PathDeformWidget*’ to ‘const QObject*’ for argument ‘1’ to ‘QList<T> qFindChildren(const QObject*, const QString&) [with T = QWidget*]’
main.cpp:40: error: invalid use of undefined type ‘struct QWidget’
../../include/QtGui/qwindowdefs.h:35: error: forward declaration of ‘struct QWidget’
main.cpp:41: error: ‘class PathDeformWidget’ has no member named ‘show’
../../include/QtCore/qobject.h: In function ‘QList<T> qFindChildren(const QObject*, const QString&) [with T = QWidget*]’:
main.cpp:38:   instantiated from here
../../include/QtCore/qobject.h:367: error: invalid use of undefined type ‘struct QWidget’
../../include/QtGui/qwindowdefs.h:35: error: forward declaration of ‘struct QWidget’
make: *** [main.o] 错误 1jun@linux:/usr/local/Trolltech/Qt-4.1.1/demos/deform> qmake -project
jun@linux:/usr/local/Trolltech/Qt-4.1.1/demos/deform> qmake
jun@linux:/usr/local/Trolltech/Qt-4.1.1/demos/deform> make all
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../mkspecs/linux-g++ -I. -I../../include/QtCore -I../../include/QtGui -I../../include -I. -I. -I. -o main.o main.cpp
In file included from main.cpp:24:
pathdeform.h:27:27: error: arthurwidgets.h: 没有那个文件或目录
pathdeform.h:34: error: expected class-name before ‘{’ token
pathdeform.h:47: error: ‘QMouseEvent’ has not been declared
pathdeform.h:48: error: ‘QMouseEvent’ has not been declared
pathdeform.h:49: error: ‘QMouseEvent’ has not been declared
pathdeform.h:50: error: ‘QTimerEvent’ has not been declared
pathdeform.h:85: error: field ‘m_lens_pixmap’ has incomplete type
pathdeform.h:86: error: field ‘m_lens_image’ has incomplete type
pathdeform.h:34: warning: ‘class PathDeformRenderer’ has virtual functions but non-virtual destructor
pathdeform.h: In member function ‘int PathDeformRenderer::radius() const’:
pathdeform.h:55: warning: converting to ‘int’ from ‘const double’
pathdeform.h: In member function ‘int PathDeformRenderer::intensity() const’:
pathdeform.h:57: warning: converting to ‘int’ from ‘const double’
pathdeform.h: At global scope:
pathdeform.h:98: error: invalid use of undefined type ‘struct QWidget’
../../include/QtGui/qwindowdefs.h:35: error: forward declaration of ‘struct QWidget’
main.cpp: In function ‘int main(int, char**)’:
main.cpp:35: error: expected type-specifier before ‘ArthurStyle’
main.cpp:35: error: cannot convert ‘int*’ to ‘QStyle*’ in initialization
main.cpp:35: error: expected ‘,’ or ‘;’ before ‘ArthurStyle’
main.cpp:36: error: ‘class PathDeformWidget’ has no member named ‘setStyle’
main.cpp:38: error: cannot convert ‘PathDeformWidget*’ to ‘const QObject*’ for argument ‘1’ to ‘QList<T> qFindChildren(const QObject*, const QString&) [with T = QWidget*]’
main.cpp:40: error: invalid use of undefined type ‘struct QWidget’
../../include/QtGui/qwindowdefs.h:35: error: forward declaration of ‘struct QWidget’
main.cpp:41: error: ‘class PathDeformWidget’ has no member named ‘show’
../../include/QtCore/qobject.h: In function ‘QList<T> qFindChildren(const QObject*, const QString&) [with T = QWidget*]’:
main.cpp:38:   instantiated from here
../../include/QtCore/qobject.h:367: error: invalid use of undefined type ‘struct QWidget’
../../include/QtGui/qwindowdefs.h:35: error: forward declaration of ‘struct QWidget’
make: *** [main.o] 错误 1jun@linux:/usr/local/Trolltech/Qt-4.1.1/demos/deform> qmake -project
jun@linux:/usr/local/Trolltech/Qt-4.1.1/demos/deform> qmake
jun@linux:/usr/local/Trolltech/Qt-4.1.1/demos/deform> make all
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../mkspecs/linux-g++ -I. -I../../include/QtCore -I../../include/QtGui -I../../include -I. -I. -I. -o main.o main.cpp
In file included from main.cpp:24:
pathdeform.h:27:27: error: arthurwidgets.h: 没有那个文件或目录
pathdeform.h:34: error: expected class-name before ‘{’ token
pathdeform.h:47: error: ‘QMouseEvent’ has not been declared
pathdeform.h:48: error: ‘QMouseEvent’ has not been declared
pathdeform.h:49: error: ‘QMouseEvent’ has not been declared
pathdeform.h:50: error: ‘QTimerEvent’ has not been declared
pathdeform.h:85: error: field ‘m_lens_pixmap’ has incomplete type
pathdeform.h:86: error: field ‘m_lens_image’ has incomplete type
pathdeform.h:34: warning: ‘class PathDeformRenderer’ has virtual functions but non-virtual destructor
pathdeform.h: In member function ‘int PathDeformRenderer::radius() const’:
pathdeform.h:55: warning: converting to ‘int’ from ‘const double’
pathdeform.h: In member function ‘int PathDeformRenderer::intensity() const’:
pathdeform.h:57: warning: converting to ‘int’ from ‘const double’
pathdeform.h: At global scope:
pathdeform.h:98: error: invalid use of undefined type ‘struct QWidget’
../../include/QtGui/qwindowdefs.h:35: error: forward declaration of ‘struct QWidget’
main.cpp: In function ‘int main(int, char**)’:
main.cpp:35: error: expected type-specifier before ‘ArthurStyle’
main.cpp:35: error: cannot convert ‘int*’ to ‘QStyle*’ in initialization
main.cpp:35: error: expected ‘,’ or ‘;’ before ‘ArthurStyle’
main.cpp:36: error: ‘class PathDeformWidget’ has no member named ‘setStyle’
main.cpp:38: error: cannot convert ‘PathDeformWidget*’ to ‘const QObject*’ for argument ‘1’ to ‘QList<T> qFindChildren(const QObject*, const QString&) [with T = QWidget*]’
main.cpp:40: error: invalid use of undefined type ‘struct QWidget’
../../include/QtGui/qwindowdefs.h:35: error: forward declaration of ‘struct QWidget’
main.cpp:41: error: ‘class PathDeformWidget’ has no member named ‘show’
../../include/QtCore/qobject.h: In function ‘QList<T> qFindChildren(const QObject*, const QString&) [with T = QWidget*]’:
main.cpp:38:   instantiated from here
../../include/QtCore/qobject.h:367: error: invalid use of undefined type ‘struct QWidget’
../../include/QtGui/qwindowdefs.h:35: error: forward declaration of ‘struct QWidget’
make: *** [main.o] 错误 1
[ 此贴被XChinux在2006-03-04 17:58重新编辑 ]
离线XChinux

只看该作者 1楼 发表于: 2006-03-05
你没有设置QTDIR环境变量以及把$(QTDIR)/bin目录加到PATH变量中吧?
另外,Demo中的东西不能这样编译吧?
工程.pro文件是人家已经有了的,你不能通过qmake -project来生成,在demo中那样生成的工程信息不全。

编译Demo中的东西,要做的只是
#qmake
#make

就行了。
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
快速回复
限100 字节
 
上一个 下一个