如何将qt4的范例spreadsheet移植上去?

来源:百度文库 编辑:神马文学网 时间:2024/06/03 09:28:59
买了mini2440学习板,按照用户手册学习了附录1“嵌入式图形系统Qtopia-2.2.0 快速移植”
也成功能在mini2440上添加hello world应用程序并运行!!
最近也买了本C++ GUI QT4学习,第三章有个spreadsheet范例程式,理解完后想像hello world那样添加到mini2440系统上,发现不是那么简单:
论坛看了没有找到相关的方法,可能自己笨找不到,哎~~
就想先在x86上编译,也编译不了:
[root@localhost hello-x86]# make
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -Os  -DQTOPIA_DATA_LINKING -DQCONFIG=\"qconfig-qpe.h\" -DQTOPIA_TARGET=\"hello\" -DQTOPIA_TRTARGET=\"hello\" -DQT_NO_DEBUG -I/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/mkspecs/qws/linux-generic-g++ -I. -I/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/include -I/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qt2/include -I.ui/release-shared/ -I.moc/release-shared/ -o .obj/release-shared/hello.o hello.cpp
hello.cpp:1:24: 错误:QApplication:没有那个文件或目录
hello.cpp:3:26: 错误:QPushButton:没有那个文件或目录
hello.cpp: In function ‘int main(int, char**)’:
hello.cpp:9: 错误:‘QApplication’在此作用域中尚未声明
hello.cpp:9: 错误:expected `;' before ‘app’
hello.cpp:11: 错误:‘QPushButton’在此作用域中尚未声明
hello.cpp:11: 错误:expected `;' before ‘b’
hello.cpp:13: 错误:‘b’在此作用域中尚未声明
hello.cpp:15: 错误:‘QObject’未声明
hello.cpp:15: 错误:‘clicked’在此作用域中尚未声明
hello.cpp:15: 错误:‘SIGNAL’在此作用域中尚未声明
hello.cpp:15: 错误:‘app’在此作用域中尚未声明
hello.cpp:15: 错误:‘quit’在此作用域中尚未声明
hello.cpp:15: 错误:‘SLOT’在此作用域中尚未声明
hello.cpp: At global scope:
hello.cpp:5: 警告:未使用的参数‘argc’
hello.cpp:5: 警告:未使用的参数‘argv’
make: *** [.obj/release-shared/hello.o] 错误 1
那位大侠能帮忙解释下啊!!谢谢了
xphcyh 2010-08-12 17:30
我直接新建一个目录chap03存放spreadsheet程序
使用的liunx系统为Fedora9
x86和arm交叉编译器应该都可以,因为hello word可以编译成功!
[root@localhost spreadsheet]# source /opt/FriendlyARM/mini2440/arm-qtopia/qtopia-2.2.0-FriendlyARM/setQpeEnv
[root@localhost spreadsheet]# qmake -spec /opt/FriendlyARM/mini2440/arm-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/mkspecs/qws/linux-arm-g++ -o Makefile *.pro
Project ERROR: Please set a target in /root/qt_study/chap03_arm/spreadsheet
//这里提示没有目标文件,在spreadsheet.pro最后一行添加TARGET = spreadsheet后重新qmake
[root@localhost spreadsheet]# qmake -spec /opt/FriendlyARM/mini2440/arm-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/mkspecs/qws/linux-arm-g++ -o Makefile *.pro
[root@localhost spreadsheet]# make
/opt/FriendlyARM/mini2440/arm-qtopia/qtopia-2.2.0-FriendlyARM/qt2/bin/uic gotocelldialog.ui -o .ui/release-shared/gotocelldialog.h
/opt/FriendlyARM/mini2440/arm-qtopia/qtopia-2.2.0-FriendlyARM/qt2/bin/uic sortdialog.ui -o .ui/release-shared/sortdialog.h
arm-linux-g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -Os  -DQT_NO_QWS_VFB -DQTOPIA_DATA_LINKING -DQCONFIG=\"qconfig-qpe.h\" -DQTOPIA_TARGET=\"spreadsheet\" -DQTOPIA_TRTARGET=\"spreadsheet\" -DQT_NO_DEBUG -I/opt/FriendlyARM/mini2440/arm-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/mkspecs/qws/linux-arm-g++ -I. -I. -I/opt/FriendlyARM/mini2440/arm-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/include -I/opt/FriendlyARM/mini2440/arm-qtopia/qtopia-2.2.0-FriendlyARM/qt2/include -I.ui/release-shared/ -I. -I. -I.moc/release-shared/ -o .obj/release-shared/cell.o cell.cpp
cell.cpp:1:17: error: QtGui: No such file or directory
In file included from cell.cpp:3:
cell.h:4:28: error: QTableWidgetItem: No such file or directory
In file included from cell.cpp:3:
cell.h:7: error: expected class-name before '{' token
cell.h:11: error: ISO C++ forbids declaration of 'QTableWidgetItem' with no type
cell.h:11: error: expected ';' before '*' token
cell.h:12: error: expected ',' or '...' before '&' token
cell.h:12: error: ISO C++ forbids declaration of 'QVariant' with no type
cell.h:13: error: 'QVariant' does not name a type
cell.h:14: error: expected ',' or '...' before '&' token
cell.h:14: error: ISO C++ forbids declaration of 'QString' with no type
cell.h:15: error: 'QString' does not name a type
cell.h:19: error: 'QVariant' does not name a type
cell.h:20: error: 'QVariant' does not name a type
cell.h:21: error: 'QVariant' does not name a type
cell.h:22: error: 'QVariant' does not name a type
cell.h:24: error: 'QVariant' does not name a type
cell.cpp:10: error: expected constructor, destructor, or type conversion before '*' token
cell.cpp:15: error: expected ',' or '...' before '&' token
cell.cpp:15: error: ISO C++ forbids declaration of 'QVariant' with no type
cell.cpp: In member function 'void Cell::setData(int, int)':
cell.cpp:17: error: 'QTableWidgetItem' has not been declared
cell.cpp:17: error: 'value' was not declared in this scope
cell.cpp:18: error: 'Qt' has not been declared
cell.cpp: At global scope:
cell.cpp:15: warning: unused parameter 'QVariant'
cell.cpp:22: error: 'QVariant' does not name a type
cell.cpp:41: error: expected ',' or '...' before '&' token
cell.cpp:41: error: ISO C++ forbids declaration of 'QString' with no type
cell.cpp: In member function 'void Cell::setFormula(int)':
cell.cpp:43: error: 'Qt' has not been declared
cell.cpp:43: error: 'formula' was not declared in this scope
cell.cpp: At global scope:
cell.cpp:41: warning: unused parameter 'QString'
cell.cpp:46: error: 'QString' does not name a type
cell.cpp:56: error: 'QVariant' does not name a type
cell.cpp:58: error: 'QVariant' does not name a type
cell.cpp:89: error: 'QVariant' does not name a type
cell.cpp:113: error: 'QVariant' does not name a type
cell.cpp:141: error: 'QVariant' does not name a type
make: *** [.obj/release-shared/cell.o] 错误 1
[root@localhost spreadsheet]#
//错误提示没有QtGui路径,改如何加载,怎么才可以编译出.exe文件和.desktop文件?
谢谢