附件为现在学习qt的教程,
运行qthread-sinx里面的./build-x86.sh后出现以下问题:
[root@localhost qthread-sinx]# ./build-x86.sh
rm -f .obj/release-shared/moc_mainwindow.o .obj/release-shared/moc_sinthread.o .obj/release-shared/moc_trithread.o
rm -f .moc/release-shared/moc_mainwindow.cpp .moc/release-shared/moc_sinthread.cpp .moc/release-shared/moc_trithread.cpp
rm -f .obj/release-shared/main.o .obj/release-shared/mainwindow.o .obj/release-shared/sinthread.o .obj/release-shared/tirthread.o
rm -f *~ core *.core
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -Os -DQTOPIA_DATA_LINKING -DQCONFIG=\"qconfig-qpe.h\" -DQTOPIA_TARGET=\"carbox\" -DQTOPIA_TRTARGET=\"carbox\" -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/main.o main.cpp
In file included from mainwindow.h:17,
from main.cpp:15:
sinthread.h:24: 错误:expected class-name before ‘{’ token
In file included from mainwindow.h:18,
from main.cpp:15:
trithread.h:24: 错误:expected class-name before ‘{’ token
make: *** [.obj/release-shared/main.o] 错误 1
[root@localhost qthread-sinx]#
是什么原因?
使用多线程是否可以在qtopia上直接使用
ret=pthread_create(&id,NULL,(void *)send, &data_send);
我使用上面这一句会出现:
main_form.cpp:100: 错误:对‘pthread_create(pthread_t*, NULL, void*, MainForm* const, mcpcan_data*)’的调用没有匹配的函数对应的调用函数是要用类函数void MainForm::send(void *arg) 对应的写成ret=pthread_create(&id,NULL,(void *)send, this,&data_send);??
还是要用静态函数void send(void *arg)
[ 此帖被xphyym在2011-01-14 16:13重新编辑 ]