管理提醒: 本帖被 arm9home 从 Linux技术交流专区 移动到本区(2009-09-10)
我编写QT多线程程序,总是报告 错误:expected class-name before ‘{’ token 还有就是说start(),wait()没有定义的错误
请帮忙解决 在此谢过啦
ext16.h文件
#ifndef _DEMO_H_
#define _DEMO_H_
#include <qapplication.h>
#include <qmainwindow.h>
#include <qpopupmenu.h>
#include <qmenubar.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qpixmap.h>
#include <qpainter.h>
#include <qmultilineedit.h>
#include <qpushbutton.h>
#include <qscrollview.h>
#include <qfont.h>
#include <qbutton.h>
#include <stdio.h>
#include <qthread.h>
#include <iostream>
class MyThread : public QThread
{
Q_OBJECT
public:
virtual void run();
};
#endif
ext16.cpp文件
#include <ext16.h>
void MyThread::run()
{
for( int count = 0; count < 20; count++ )
{
sleep( 1 );
qDebug( "Ping!" );
}
}
int main()
{
MyThread a;
MyThread b;
a.start();
b.start();
a.wait();
b.wait();
}
pro文件
TEMPLATE = app
CONFIG = qt warn_on release
HEADERS = ext16.h
SOURCES = ext16.cpp
INTERFACES =
TARGET = hello
bulid文件
#!/bin/bash
source /root/workspace/tools/QT/target-x86/x86-qtopia/qtopia-2.2.0-FriendlyARM/setQpeEnv
qmake -o Makefile -spec /root/workspace/tools/QT/target-x86/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/mkspecs/qws/linux-generic-g++ *.pro
make clean
make