PDA

View Full Version : Compile Errors



luffy27
4th November 2006, 04:08
I downloaded a app which is a simple calculator. But when I try to compile it and run it on my own machine there showed many errors.
And the way i compile the app is :
1. qmake -project
2. qmake
3. make
My Qt version is 3.3.3. I don't know where is the problem or what is the right way to compile and run the app. I be totally a fresh man with Qt.
please HELP me .Thanks.

munna
4th November 2006, 05:02
Can you post the errors that you are getting?

luffy27
4th November 2006, 05:41
Can you post the errors that you are getting?

Here is the errors:

g++ -c -pipe -Wall -W -O2 -g -pipe -m32 -march=i386 -mtune=pentium4 -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT -I/usr/lib/qt-3.3/mkspecs/default -I. -I. -I/usr/lib/qt-3.3/include -o main.o main.cpp
In file included from main.cpp:1:
form.h:4:27: QtCore/QVariant: 没有那个文件或目录
form.h:5:25: QtGui/QAction: 没有那个文件或目录
form.h:6:30: QtGui/QApplication: 没有那个文件或目录
form.h:7:30: QtGui/QButtonGroup: 没有那个文件或目录
form.h:8:27: QtGui/QComboBox: 没有那个文件或目录
form.h:9:29: QtGui/QHBoxLayout: 没有那个文件或目录
form.h:10:24: QtGui/QLabel: 没有那个文件或目录
form.h:11:27: QtGui/QLineEdit: 没有那个文件或目录
form.h:12:29: QtGui/QPushButton: 没有那个文件或目录
form.h:13:25: QtGui/QWidget: 没有那个文件或目录
form.h:14:29: QtGui/QMainWindow: 没有那个文件或目录
form.h:15:28: QDoubleValidator: 没有那个文件或目录
form.h:16:18: QDebug: 没有那个文件或目录
In file included from main.cpp:1:
form.h:19: error: expected class-name before '{' token
form.h:21: error: ISO C++ forbids declaration of `Q_OBJECT' with no type
form.h:21: error: expected `;' before "public"
form.h:24: error: expected `:' before "slots"
form.h:25: error: expected primary-expression before "void"
form.h:25: error: ISO C++ forbids declaration of `slots' with no type
form.h:25: error: expected `;' before "void"
form.h:27: error: ISO C++ forbids declaration of `QWidget' with no type
form.h:27: error: expected `;' before '*' token
form.h:28: error: ISO C++ forbids declaration of `QHBoxLayout' with no type
form.h:28: error: expected `;' before '*' token
form.h:29: error: ISO C++ forbids declaration of `QLineEdit' with no type
form.h:29: error: expected `;' before '*' token
form.h:30: error: ISO C++ forbids declaration of `QComboBox' with no type
form.h:30: error: expected `;' before '*' token
form.h:31: error: ISO C++ forbids declaration of `QLineEdit' with no type
form.h:31: error: expected `;' before '*' token
form.h:32: error: ISO C++ forbids declaration of `QLabel' with no type
form.h:32: error: expected `;' before '*' token
form.h:33: error: ISO C++ forbids declaration of `QLineEdit' with no type
form.h:33: error: expected `;' before '*' token
form.h:34: error: ISO C++ forbids declaration of `QWidget' with no type
form.h:34: error: expected `;' before '*' token
form.h:35: error: ISO C++ forbids declaration of `QHBoxLayout' with no type
form.h:35: error: expected `;' before '*' token
form.h:36: error: ISO C++ forbids declaration of `QPushButton' with no type
form.h:36: error: expected `;' before '*' token
form.h:37: error: ISO C++ forbids declaration of `QPushButton' with no type
form.h:37: error: expected `;' before '*' token
form.h:38: error: ISO C++ forbids declaration of `QLabel' with no type
form.h:38: error: expected `;' before '*' token
form.h:39: error: ISO C++ forbids declaration of `QDoubleValidator' with no typeform.h:39: error: expected `;' before '*' token
main.cpp:2:23: QtGui/QtGui: 没有那个文件或目录
main.cpp: In function `int main(int, char**)':
main.cpp:6: error: `QApplication' undeclared (first use this function)
main.cpp:6: error: (Each undeclared identifier is reported only once for each function it appears in.)
main.cpp:6: error: expected `;' before "app"
main.cpp:9: error: 'class Form' has no member named 'show'
main.cpp:10: error: `app' undeclared (first use this function)
main.cpp: At global scope:
main.cpp:5: warning: unused parameter 'argc'
main.cpp:5: warning: unused parameter 'argv'
make: *** [main.o] 错误 1

munna
4th November 2006, 06:26
You are using Qt 3.3.3 but the code is for Qt 4 and that is why you are getting the errors