[root@localhost mywork]# ls
lily.cpp lily.h lily.pro lily.ui main.cpp Makefile
[root@localhost mywork]# make
Makefile:120: warning: overriding commands for target `moc_lily.cpp'
Makefile:117: warning: ignoring old commands for target `moc_lily.cpp'
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/root/qt/include -o lily.o lily.cpp
In file included from lily.cpp:10:
lily.h:13:22: qvariant.h: 没有那个文件或目录
lily.h:14:21: qwidget.h: 没有那个文件或目录
In file included from lily.cpp:10:
lily.h:22: parse error before `{' token
lily.h:27: destructors must be member functions
lily.h:31: parse error before `protected'
lily.cpp:12:22: qvariant.h: 没有那个文件或目录
lily.cpp:13:25: qpushbutton.h: 没有那个文件或目录
lily.cpp:14:21: qlayout.h: 没有那个文件或目录
lily.cpp:15:22: qtooltip.h: 没有那个文件或目录
lily.cpp:16:24: qwhatsthis.h: 没有那个文件或目录
lily.cpp:22: `QWidget' was not declared in this scope
lily.cpp:22: `parent' was not declared in this scope
lily.cpp:22: parse error before `char'
lily.cpp:23: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
lily.cpp: In constructor `test::test(...)':
lily.cpp:23: `parent' undeclared (first use this function)
lily.cpp:23: (Each undeclared identifier is reported only once for each
function it appears in.)
lily.cpp:23: `name' undeclared (first use this function)
lily.cpp:23: `fl' undeclared (first use this function)
lily.cpp:23: class `test' does not have any field named `QWidget'
lily.cpp:26: `setName' undeclared (first use this function)
lily.cpp:28: invalid use of undefined type `struct QPushButton'
lily.h:19: forward declaration of `struct QPushButton'
lily.cpp:29: `QRect' undeclared (first use this function)
lily.cpp:30: `languageChange' undeclared (first use this function)
lily.cpp:31: `QSize' undeclared (first use this function)
lily.cpp:31: `minimumSizeHint' undeclared (first use this function)
lily.cpp:31: `resize' undeclared (first use this function)
lily.cpp: At global scope:
lily.cpp:38: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
lily.cpp:47: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
lily.cpp: In member function `void test::languageChange()':
lily.cpp:48: `tr' undeclared (first use this function)
lily.cpp:48: `setCaption' undeclared (first use this function)
make: *** [lily.o] Error 1
[root@localhost mywork]# echo $TMAKEPATH
/root/tmakepath
[root@localhost mywork]# echo $QTDIR
/root/qt
[root@localhost mywork]# echo $LD_LIBRARY_PATH
/root/qt/lib
[root@localhost mywork]#
6 个解决方案
#1
"lily.h:13:22: qvariant.h: 没有那个文件或目录"
应该是缺少头文件。
应该是缺少头文件。
#2
在lily.h中include了qvariant.h, qwidget.h等几个文件,但是编译系统没有找到该文件。编译系统将在如下几个目录查找所需include的文件:
1) 执行make命令的当前目录
2) g++中-I选项后所指定的目录
3) 系统目录,既PATH环境变量设置的目录
你应该找到qvariant.h, qwidget.h所在目录,使用-I选项将其加入到搜索目录中。
1) 执行make命令的当前目录
2) g++中-I选项后所指定的目录
3) 系统目录,既PATH环境变量设置的目录
你应该找到qvariant.h, qwidget.h所在目录,使用-I选项将其加入到搜索目录中。
#3
把 -i 选项加上,后面跟上你要包含的头文件
#4
我按大侠的意思把对应的头文件加进来,还是提示同样的错误啊
[root@localhost root]# cd mywork
[root@localhost mywork]# ls
1.doc lily.cpp lily.h lily.pro lily.ui main.cpp Makefile moc_lily.cpp
[root@localhost mywork]# g++ -I$QTDIR/include qvariant.h qwidget.h lily.cpp main.cpp moc_lily.cpp
g++: qvariant.h: 没有那个文件或目录
g++: qwidget.h: 没有那个文件或目录
In file included from lily.cpp:10:
lily.h:13:22: qvariant.h: 没有那个文件或目录
lily.h:14:21: qwidget.h: 没有那个文件或目录
In file included from lily.cpp:10:
lily.h:22: parse error before `{' token
lily.h:27: destructors must be member functions
lily.h:31: parse error before `protected'
lily.cpp:12:22: qvariant.h: 没有那个文件或目录
lily.cpp:13:25: qpushbutton.h: 没有那个文件或目录
lily.cpp:14:21: qlayout.h: 没有那个文件或目录
lily.cpp:15:22: qtooltip.h: 没有那个文件或目录
lily.cpp:16:24: qwhatsthis.h: 没有那个文件或目录
lily.cpp:22: `QWidget' was not declared in this scope
lily.cpp:22: `parent' was not declared in this scope
lily.cpp:22: parse error before `char'
lily.cpp:23: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
lily.cpp: In constructor `test::test(...)':
lily.cpp:23: `parent' undeclared (first use this function)
lily.cpp:23: (Each undeclared identifier is reported only once for each
function it appears in.)
lily.cpp:23: `name' undeclared (first use this function)
lily.cpp:23: `fl' undeclared (first use this function)
lily.cpp:23: class `test' does not have any field named `QWidget'
lily.cpp:26: `setName' undeclared (first use this function)
lily.cpp:28: invalid use of undefined type `struct QPushButton'
lily.h:19: forward declaration of `struct QPushButton'
lily.cpp:29: `QRect' undeclared (first use this function)
lily.cpp:30: `languageChange' undeclared (first use this function)
lily.cpp:31: `QSize' undeclared (first use this function)
lily.cpp:31: `minimumSizeHint' undeclared (first use this function)
lily.cpp:31: `resize' undeclared (first use this function)
lily.cpp: At global scope:
lily.cpp:38: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
lily.cpp:47: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
lily.cpp: In member function `void test::languageChange()':
lily.cpp:48: `tr' undeclared (first use this function)
lily.cpp:48: `setCaption' undeclared (first use this function)
main.cpp:1:26: qapplication.h: 没有那个文件或目录
In file included from main.cpp:2:
lily.h:13:22: qvariant.h: 没有那个文件或目录
lily.h:14:21: qwidget.h: 没有那个文件或目录
In file included from main.cpp:2:
lily.h:22: parse error before `{' token
lily.h:27: destructors must be member functions
lily.h:31: parse error before `protected'
main.cpp: In function `int main(int, char**)':
main.cpp:6: `QApplication' undeclared (first use this function)
main.cpp:6: (Each undeclared identifier is reported only once for each function
it appears in.)
main.cpp:6: parse error before `(' token
main.cpp:7: `test' undeclared (first use this function)
main.cpp:8: `dlg' undeclared (first use this function)
main.cpp:9: `a' undeclared (first use this function)
main.cpp:10:2: warning: no newline at end of file
In file included from moc_lily.cpp:8:
lily.h:13:22: qvariant.h: 没有那个文件或目录
lily.h:14:21: qwidget.h: 没有那个文件或目录
In file included from moc_lily.cpp:8:
lily.h:22: parse error before `{' token
lily.h:27: destructors must be member functions
lily.h:31: parse error before `protected'
moc_lily.cpp:9:25: qmetaobject.h: 没有那个文件或目录
moc_lily.cpp:10:26: qapplication.h: 没有那个文件或目录
moc_lily.cpp:12:34: private/qucomextra_p.h: 没有那个文件或目录
moc_lily.cpp:14:2: #error "This file was generated using the moc from 3.1.1. It"moc_lily.cpp:15:2: #error "cannot be used with the include files from this version of Qt."
moc_lily.cpp:16:2: #error "(The moc has changed too much.)"
moc_lily.cpp:20: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp:24: syntax error before `*' token
moc_lily.cpp:25: syntax error before `(' token
moc_lily.cpp:28: syntax error before `::' token
moc_lily.cpp:36: syntax error before `::' token
moc_lily.cpp:47: syntax error before `*' token
moc_lily.cpp:51: syntax error before `*' token
moc_lily.cpp:52: syntax error before `=' token
moc_lily.cpp:53: syntax error before `[' token
moc_lily.cpp:56: ISO C++ forbids declaration of `metaObj' with no type
moc_lily.cpp:56: `QMetaObject' was not declared in this scope
moc_lily.cpp:56: parse error before `::' token
moc_lily.cpp:65: syntax error before `.' token
moc_lily.cpp:70: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `void* test::qt_cast(const char*)':
moc_lily.cpp:71: `qstrcmp' undeclared (first use this function)
moc_lily.cpp:71: (Each undeclared identifier is reported only once for each
function it appears in.)
moc_lily.cpp:73: `QWidget' undeclared (first use this function)
moc_lily.cpp:73: parse error before `::' token
moc_lily.cpp: At global scope:
moc_lily.cpp:76: type specifier omitted for parameter `QUObject'
moc_lily.cpp:76: parse error before `*' token
moc_lily.cpp:77: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `bool test::qt_invoke(...)':
moc_lily.cpp:78: `_id' undeclared (first use this function)
moc_lily.cpp:78: `staticMetaObject' undeclared (first use this function)
moc_lily.cpp:79: `languageChange' undeclared (first use this function)
moc_lily.cpp:81: parse error before `::' token
moc_lily.cpp:83: `TRUE' undeclared (first use this function)
moc_lily.cpp: At global scope:
moc_lily.cpp:86: type specifier omitted for parameter `QUObject'
moc_lily.cpp:86: parse error before `*' token
moc_lily.cpp:87: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `bool test::qt_emit(...)':
moc_lily.cpp:88: parse error before `::' token
moc_lily.cpp: At global scope:
moc_lily.cpp:92: type specifier omitted for parameter `QVariant'
moc_lily.cpp:92: parse error before `*' token
moc_lily.cpp:93: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `bool test::qt_property(...)':
moc_lily.cpp:94: parse error before `::' token
moc_lily.cpp: At global scope:
moc_lily.cpp:97: `QObject' was not declared in this scope
moc_lily.cpp:97: parse error before `,' token
moc_lily.cpp:97: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `bool test::qt_static_property(...)':
moc_lily.cpp:97: `FALSE' undeclared (first use this function)
[root@localhost mywork]#
[root@localhost root]# cd mywork
[root@localhost mywork]# ls
1.doc lily.cpp lily.h lily.pro lily.ui main.cpp Makefile moc_lily.cpp
[root@localhost mywork]# g++ -I$QTDIR/include qvariant.h qwidget.h lily.cpp main.cpp moc_lily.cpp
g++: qvariant.h: 没有那个文件或目录
g++: qwidget.h: 没有那个文件或目录
In file included from lily.cpp:10:
lily.h:13:22: qvariant.h: 没有那个文件或目录
lily.h:14:21: qwidget.h: 没有那个文件或目录
In file included from lily.cpp:10:
lily.h:22: parse error before `{' token
lily.h:27: destructors must be member functions
lily.h:31: parse error before `protected'
lily.cpp:12:22: qvariant.h: 没有那个文件或目录
lily.cpp:13:25: qpushbutton.h: 没有那个文件或目录
lily.cpp:14:21: qlayout.h: 没有那个文件或目录
lily.cpp:15:22: qtooltip.h: 没有那个文件或目录
lily.cpp:16:24: qwhatsthis.h: 没有那个文件或目录
lily.cpp:22: `QWidget' was not declared in this scope
lily.cpp:22: `parent' was not declared in this scope
lily.cpp:22: parse error before `char'
lily.cpp:23: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
lily.cpp: In constructor `test::test(...)':
lily.cpp:23: `parent' undeclared (first use this function)
lily.cpp:23: (Each undeclared identifier is reported only once for each
function it appears in.)
lily.cpp:23: `name' undeclared (first use this function)
lily.cpp:23: `fl' undeclared (first use this function)
lily.cpp:23: class `test' does not have any field named `QWidget'
lily.cpp:26: `setName' undeclared (first use this function)
lily.cpp:28: invalid use of undefined type `struct QPushButton'
lily.h:19: forward declaration of `struct QPushButton'
lily.cpp:29: `QRect' undeclared (first use this function)
lily.cpp:30: `languageChange' undeclared (first use this function)
lily.cpp:31: `QSize' undeclared (first use this function)
lily.cpp:31: `minimumSizeHint' undeclared (first use this function)
lily.cpp:31: `resize' undeclared (first use this function)
lily.cpp: At global scope:
lily.cpp:38: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
lily.cpp:47: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
lily.cpp: In member function `void test::languageChange()':
lily.cpp:48: `tr' undeclared (first use this function)
lily.cpp:48: `setCaption' undeclared (first use this function)
main.cpp:1:26: qapplication.h: 没有那个文件或目录
In file included from main.cpp:2:
lily.h:13:22: qvariant.h: 没有那个文件或目录
lily.h:14:21: qwidget.h: 没有那个文件或目录
In file included from main.cpp:2:
lily.h:22: parse error before `{' token
lily.h:27: destructors must be member functions
lily.h:31: parse error before `protected'
main.cpp: In function `int main(int, char**)':
main.cpp:6: `QApplication' undeclared (first use this function)
main.cpp:6: (Each undeclared identifier is reported only once for each function
it appears in.)
main.cpp:6: parse error before `(' token
main.cpp:7: `test' undeclared (first use this function)
main.cpp:8: `dlg' undeclared (first use this function)
main.cpp:9: `a' undeclared (first use this function)
main.cpp:10:2: warning: no newline at end of file
In file included from moc_lily.cpp:8:
lily.h:13:22: qvariant.h: 没有那个文件或目录
lily.h:14:21: qwidget.h: 没有那个文件或目录
In file included from moc_lily.cpp:8:
lily.h:22: parse error before `{' token
lily.h:27: destructors must be member functions
lily.h:31: parse error before `protected'
moc_lily.cpp:9:25: qmetaobject.h: 没有那个文件或目录
moc_lily.cpp:10:26: qapplication.h: 没有那个文件或目录
moc_lily.cpp:12:34: private/qucomextra_p.h: 没有那个文件或目录
moc_lily.cpp:14:2: #error "This file was generated using the moc from 3.1.1. It"moc_lily.cpp:15:2: #error "cannot be used with the include files from this version of Qt."
moc_lily.cpp:16:2: #error "(The moc has changed too much.)"
moc_lily.cpp:20: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp:24: syntax error before `*' token
moc_lily.cpp:25: syntax error before `(' token
moc_lily.cpp:28: syntax error before `::' token
moc_lily.cpp:36: syntax error before `::' token
moc_lily.cpp:47: syntax error before `*' token
moc_lily.cpp:51: syntax error before `*' token
moc_lily.cpp:52: syntax error before `=' token
moc_lily.cpp:53: syntax error before `[' token
moc_lily.cpp:56: ISO C++ forbids declaration of `metaObj' with no type
moc_lily.cpp:56: `QMetaObject' was not declared in this scope
moc_lily.cpp:56: parse error before `::' token
moc_lily.cpp:65: syntax error before `.' token
moc_lily.cpp:70: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `void* test::qt_cast(const char*)':
moc_lily.cpp:71: `qstrcmp' undeclared (first use this function)
moc_lily.cpp:71: (Each undeclared identifier is reported only once for each
function it appears in.)
moc_lily.cpp:73: `QWidget' undeclared (first use this function)
moc_lily.cpp:73: parse error before `::' token
moc_lily.cpp: At global scope:
moc_lily.cpp:76: type specifier omitted for parameter `QUObject'
moc_lily.cpp:76: parse error before `*' token
moc_lily.cpp:77: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `bool test::qt_invoke(...)':
moc_lily.cpp:78: `_id' undeclared (first use this function)
moc_lily.cpp:78: `staticMetaObject' undeclared (first use this function)
moc_lily.cpp:79: `languageChange' undeclared (first use this function)
moc_lily.cpp:81: parse error before `::' token
moc_lily.cpp:83: `TRUE' undeclared (first use this function)
moc_lily.cpp: At global scope:
moc_lily.cpp:86: type specifier omitted for parameter `QUObject'
moc_lily.cpp:86: parse error before `*' token
moc_lily.cpp:87: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `bool test::qt_emit(...)':
moc_lily.cpp:88: parse error before `::' token
moc_lily.cpp: At global scope:
moc_lily.cpp:92: type specifier omitted for parameter `QVariant'
moc_lily.cpp:92: parse error before `*' token
moc_lily.cpp:93: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `bool test::qt_property(...)':
moc_lily.cpp:94: parse error before `::' token
moc_lily.cpp: At global scope:
moc_lily.cpp:97: `QObject' was not declared in this scope
moc_lily.cpp:97: parse error before `,' token
moc_lily.cpp:97: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `bool test::qt_static_property(...)':
moc_lily.cpp:97: `FALSE' undeclared (first use this function)
[root@localhost mywork]#
#5
自动生成的,肯定已经加了!
再检查一下你的makefile!
估计是你的libs搞错了
再检查一下你的makefile!
估计是你的libs搞错了
#6
lz 用的是 QT4 吧
qwidget.h 应该是 QT3 和以前版本的头文件
如果用 QT4 编译 QT3 代码需要定义
qwidget.h 应该是 QT3 和以前版本的头文件
如果用 QT4 编译 QT3 代码需要定义
#define QT3_SUPPORT
#1
"lily.h:13:22: qvariant.h: 没有那个文件或目录"
应该是缺少头文件。
应该是缺少头文件。
#2
在lily.h中include了qvariant.h, qwidget.h等几个文件,但是编译系统没有找到该文件。编译系统将在如下几个目录查找所需include的文件:
1) 执行make命令的当前目录
2) g++中-I选项后所指定的目录
3) 系统目录,既PATH环境变量设置的目录
你应该找到qvariant.h, qwidget.h所在目录,使用-I选项将其加入到搜索目录中。
1) 执行make命令的当前目录
2) g++中-I选项后所指定的目录
3) 系统目录,既PATH环境变量设置的目录
你应该找到qvariant.h, qwidget.h所在目录,使用-I选项将其加入到搜索目录中。
#3
把 -i 选项加上,后面跟上你要包含的头文件
#4
我按大侠的意思把对应的头文件加进来,还是提示同样的错误啊
[root@localhost root]# cd mywork
[root@localhost mywork]# ls
1.doc lily.cpp lily.h lily.pro lily.ui main.cpp Makefile moc_lily.cpp
[root@localhost mywork]# g++ -I$QTDIR/include qvariant.h qwidget.h lily.cpp main.cpp moc_lily.cpp
g++: qvariant.h: 没有那个文件或目录
g++: qwidget.h: 没有那个文件或目录
In file included from lily.cpp:10:
lily.h:13:22: qvariant.h: 没有那个文件或目录
lily.h:14:21: qwidget.h: 没有那个文件或目录
In file included from lily.cpp:10:
lily.h:22: parse error before `{' token
lily.h:27: destructors must be member functions
lily.h:31: parse error before `protected'
lily.cpp:12:22: qvariant.h: 没有那个文件或目录
lily.cpp:13:25: qpushbutton.h: 没有那个文件或目录
lily.cpp:14:21: qlayout.h: 没有那个文件或目录
lily.cpp:15:22: qtooltip.h: 没有那个文件或目录
lily.cpp:16:24: qwhatsthis.h: 没有那个文件或目录
lily.cpp:22: `QWidget' was not declared in this scope
lily.cpp:22: `parent' was not declared in this scope
lily.cpp:22: parse error before `char'
lily.cpp:23: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
lily.cpp: In constructor `test::test(...)':
lily.cpp:23: `parent' undeclared (first use this function)
lily.cpp:23: (Each undeclared identifier is reported only once for each
function it appears in.)
lily.cpp:23: `name' undeclared (first use this function)
lily.cpp:23: `fl' undeclared (first use this function)
lily.cpp:23: class `test' does not have any field named `QWidget'
lily.cpp:26: `setName' undeclared (first use this function)
lily.cpp:28: invalid use of undefined type `struct QPushButton'
lily.h:19: forward declaration of `struct QPushButton'
lily.cpp:29: `QRect' undeclared (first use this function)
lily.cpp:30: `languageChange' undeclared (first use this function)
lily.cpp:31: `QSize' undeclared (first use this function)
lily.cpp:31: `minimumSizeHint' undeclared (first use this function)
lily.cpp:31: `resize' undeclared (first use this function)
lily.cpp: At global scope:
lily.cpp:38: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
lily.cpp:47: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
lily.cpp: In member function `void test::languageChange()':
lily.cpp:48: `tr' undeclared (first use this function)
lily.cpp:48: `setCaption' undeclared (first use this function)
main.cpp:1:26: qapplication.h: 没有那个文件或目录
In file included from main.cpp:2:
lily.h:13:22: qvariant.h: 没有那个文件或目录
lily.h:14:21: qwidget.h: 没有那个文件或目录
In file included from main.cpp:2:
lily.h:22: parse error before `{' token
lily.h:27: destructors must be member functions
lily.h:31: parse error before `protected'
main.cpp: In function `int main(int, char**)':
main.cpp:6: `QApplication' undeclared (first use this function)
main.cpp:6: (Each undeclared identifier is reported only once for each function
it appears in.)
main.cpp:6: parse error before `(' token
main.cpp:7: `test' undeclared (first use this function)
main.cpp:8: `dlg' undeclared (first use this function)
main.cpp:9: `a' undeclared (first use this function)
main.cpp:10:2: warning: no newline at end of file
In file included from moc_lily.cpp:8:
lily.h:13:22: qvariant.h: 没有那个文件或目录
lily.h:14:21: qwidget.h: 没有那个文件或目录
In file included from moc_lily.cpp:8:
lily.h:22: parse error before `{' token
lily.h:27: destructors must be member functions
lily.h:31: parse error before `protected'
moc_lily.cpp:9:25: qmetaobject.h: 没有那个文件或目录
moc_lily.cpp:10:26: qapplication.h: 没有那个文件或目录
moc_lily.cpp:12:34: private/qucomextra_p.h: 没有那个文件或目录
moc_lily.cpp:14:2: #error "This file was generated using the moc from 3.1.1. It"moc_lily.cpp:15:2: #error "cannot be used with the include files from this version of Qt."
moc_lily.cpp:16:2: #error "(The moc has changed too much.)"
moc_lily.cpp:20: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp:24: syntax error before `*' token
moc_lily.cpp:25: syntax error before `(' token
moc_lily.cpp:28: syntax error before `::' token
moc_lily.cpp:36: syntax error before `::' token
moc_lily.cpp:47: syntax error before `*' token
moc_lily.cpp:51: syntax error before `*' token
moc_lily.cpp:52: syntax error before `=' token
moc_lily.cpp:53: syntax error before `[' token
moc_lily.cpp:56: ISO C++ forbids declaration of `metaObj' with no type
moc_lily.cpp:56: `QMetaObject' was not declared in this scope
moc_lily.cpp:56: parse error before `::' token
moc_lily.cpp:65: syntax error before `.' token
moc_lily.cpp:70: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `void* test::qt_cast(const char*)':
moc_lily.cpp:71: `qstrcmp' undeclared (first use this function)
moc_lily.cpp:71: (Each undeclared identifier is reported only once for each
function it appears in.)
moc_lily.cpp:73: `QWidget' undeclared (first use this function)
moc_lily.cpp:73: parse error before `::' token
moc_lily.cpp: At global scope:
moc_lily.cpp:76: type specifier omitted for parameter `QUObject'
moc_lily.cpp:76: parse error before `*' token
moc_lily.cpp:77: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `bool test::qt_invoke(...)':
moc_lily.cpp:78: `_id' undeclared (first use this function)
moc_lily.cpp:78: `staticMetaObject' undeclared (first use this function)
moc_lily.cpp:79: `languageChange' undeclared (first use this function)
moc_lily.cpp:81: parse error before `::' token
moc_lily.cpp:83: `TRUE' undeclared (first use this function)
moc_lily.cpp: At global scope:
moc_lily.cpp:86: type specifier omitted for parameter `QUObject'
moc_lily.cpp:86: parse error before `*' token
moc_lily.cpp:87: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `bool test::qt_emit(...)':
moc_lily.cpp:88: parse error before `::' token
moc_lily.cpp: At global scope:
moc_lily.cpp:92: type specifier omitted for parameter `QVariant'
moc_lily.cpp:92: parse error before `*' token
moc_lily.cpp:93: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `bool test::qt_property(...)':
moc_lily.cpp:94: parse error before `::' token
moc_lily.cpp: At global scope:
moc_lily.cpp:97: `QObject' was not declared in this scope
moc_lily.cpp:97: parse error before `,' token
moc_lily.cpp:97: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `bool test::qt_static_property(...)':
moc_lily.cpp:97: `FALSE' undeclared (first use this function)
[root@localhost mywork]#
[root@localhost root]# cd mywork
[root@localhost mywork]# ls
1.doc lily.cpp lily.h lily.pro lily.ui main.cpp Makefile moc_lily.cpp
[root@localhost mywork]# g++ -I$QTDIR/include qvariant.h qwidget.h lily.cpp main.cpp moc_lily.cpp
g++: qvariant.h: 没有那个文件或目录
g++: qwidget.h: 没有那个文件或目录
In file included from lily.cpp:10:
lily.h:13:22: qvariant.h: 没有那个文件或目录
lily.h:14:21: qwidget.h: 没有那个文件或目录
In file included from lily.cpp:10:
lily.h:22: parse error before `{' token
lily.h:27: destructors must be member functions
lily.h:31: parse error before `protected'
lily.cpp:12:22: qvariant.h: 没有那个文件或目录
lily.cpp:13:25: qpushbutton.h: 没有那个文件或目录
lily.cpp:14:21: qlayout.h: 没有那个文件或目录
lily.cpp:15:22: qtooltip.h: 没有那个文件或目录
lily.cpp:16:24: qwhatsthis.h: 没有那个文件或目录
lily.cpp:22: `QWidget' was not declared in this scope
lily.cpp:22: `parent' was not declared in this scope
lily.cpp:22: parse error before `char'
lily.cpp:23: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
lily.cpp: In constructor `test::test(...)':
lily.cpp:23: `parent' undeclared (first use this function)
lily.cpp:23: (Each undeclared identifier is reported only once for each
function it appears in.)
lily.cpp:23: `name' undeclared (first use this function)
lily.cpp:23: `fl' undeclared (first use this function)
lily.cpp:23: class `test' does not have any field named `QWidget'
lily.cpp:26: `setName' undeclared (first use this function)
lily.cpp:28: invalid use of undefined type `struct QPushButton'
lily.h:19: forward declaration of `struct QPushButton'
lily.cpp:29: `QRect' undeclared (first use this function)
lily.cpp:30: `languageChange' undeclared (first use this function)
lily.cpp:31: `QSize' undeclared (first use this function)
lily.cpp:31: `minimumSizeHint' undeclared (first use this function)
lily.cpp:31: `resize' undeclared (first use this function)
lily.cpp: At global scope:
lily.cpp:38: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
lily.cpp:47: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
lily.cpp: In member function `void test::languageChange()':
lily.cpp:48: `tr' undeclared (first use this function)
lily.cpp:48: `setCaption' undeclared (first use this function)
main.cpp:1:26: qapplication.h: 没有那个文件或目录
In file included from main.cpp:2:
lily.h:13:22: qvariant.h: 没有那个文件或目录
lily.h:14:21: qwidget.h: 没有那个文件或目录
In file included from main.cpp:2:
lily.h:22: parse error before `{' token
lily.h:27: destructors must be member functions
lily.h:31: parse error before `protected'
main.cpp: In function `int main(int, char**)':
main.cpp:6: `QApplication' undeclared (first use this function)
main.cpp:6: (Each undeclared identifier is reported only once for each function
it appears in.)
main.cpp:6: parse error before `(' token
main.cpp:7: `test' undeclared (first use this function)
main.cpp:8: `dlg' undeclared (first use this function)
main.cpp:9: `a' undeclared (first use this function)
main.cpp:10:2: warning: no newline at end of file
In file included from moc_lily.cpp:8:
lily.h:13:22: qvariant.h: 没有那个文件或目录
lily.h:14:21: qwidget.h: 没有那个文件或目录
In file included from moc_lily.cpp:8:
lily.h:22: parse error before `{' token
lily.h:27: destructors must be member functions
lily.h:31: parse error before `protected'
moc_lily.cpp:9:25: qmetaobject.h: 没有那个文件或目录
moc_lily.cpp:10:26: qapplication.h: 没有那个文件或目录
moc_lily.cpp:12:34: private/qucomextra_p.h: 没有那个文件或目录
moc_lily.cpp:14:2: #error "This file was generated using the moc from 3.1.1. It"moc_lily.cpp:15:2: #error "cannot be used with the include files from this version of Qt."
moc_lily.cpp:16:2: #error "(The moc has changed too much.)"
moc_lily.cpp:20: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp:24: syntax error before `*' token
moc_lily.cpp:25: syntax error before `(' token
moc_lily.cpp:28: syntax error before `::' token
moc_lily.cpp:36: syntax error before `::' token
moc_lily.cpp:47: syntax error before `*' token
moc_lily.cpp:51: syntax error before `*' token
moc_lily.cpp:52: syntax error before `=' token
moc_lily.cpp:53: syntax error before `[' token
moc_lily.cpp:56: ISO C++ forbids declaration of `metaObj' with no type
moc_lily.cpp:56: `QMetaObject' was not declared in this scope
moc_lily.cpp:56: parse error before `::' token
moc_lily.cpp:65: syntax error before `.' token
moc_lily.cpp:70: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `void* test::qt_cast(const char*)':
moc_lily.cpp:71: `qstrcmp' undeclared (first use this function)
moc_lily.cpp:71: (Each undeclared identifier is reported only once for each
function it appears in.)
moc_lily.cpp:73: `QWidget' undeclared (first use this function)
moc_lily.cpp:73: parse error before `::' token
moc_lily.cpp: At global scope:
moc_lily.cpp:76: type specifier omitted for parameter `QUObject'
moc_lily.cpp:76: parse error before `*' token
moc_lily.cpp:77: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `bool test::qt_invoke(...)':
moc_lily.cpp:78: `_id' undeclared (first use this function)
moc_lily.cpp:78: `staticMetaObject' undeclared (first use this function)
moc_lily.cpp:79: `languageChange' undeclared (first use this function)
moc_lily.cpp:81: parse error before `::' token
moc_lily.cpp:83: `TRUE' undeclared (first use this function)
moc_lily.cpp: At global scope:
moc_lily.cpp:86: type specifier omitted for parameter `QUObject'
moc_lily.cpp:86: parse error before `*' token
moc_lily.cpp:87: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `bool test::qt_emit(...)':
moc_lily.cpp:88: parse error before `::' token
moc_lily.cpp: At global scope:
moc_lily.cpp:92: type specifier omitted for parameter `QVariant'
moc_lily.cpp:92: parse error before `*' token
moc_lily.cpp:93: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `bool test::qt_property(...)':
moc_lily.cpp:94: parse error before `::' token
moc_lily.cpp: At global scope:
moc_lily.cpp:97: `QObject' was not declared in this scope
moc_lily.cpp:97: parse error before `,' token
moc_lily.cpp:97: invalid use of undefined type `class test'
lily.h:21: forward declaration of `class test'
moc_lily.cpp: In member function `bool test::qt_static_property(...)':
moc_lily.cpp:97: `FALSE' undeclared (first use this function)
[root@localhost mywork]#
#5
自动生成的,肯定已经加了!
再检查一下你的makefile!
估计是你的libs搞错了
再检查一下你的makefile!
估计是你的libs搞错了
#6
lz 用的是 QT4 吧
qwidget.h 应该是 QT3 和以前版本的头文件
如果用 QT4 编译 QT3 代码需要定义
qwidget.h 应该是 QT3 和以前版本的头文件
如果用 QT4 编译 QT3 代码需要定义
#define QT3_SUPPORT