首页| 论坛| 消息

标题:请教一个问题
作者:caffee_1989
日期:2011-05-14 21:07
内容:

出现错误:expected class-name before '{' token
一般是什么问题导致,网上很多说是大小写导致,但我改了几次都不行,大家都来发表下意见拉。


#1 [XChinux 05-14 21:34]
把代码帖出来下。
#2 回 1楼(XChinux) 的帖子 [caffee_1989 05-15 10:30]
其实这个程序是参考网上修改的,是用于串口通信,用一个线程实现.
一共有5个文件:thread.hthread.cppmainwindow.hmainwindow.cppmain.cpp
thread.h :
#ifndef THREAD_H
#define THREAD_H
#include
class Thread : public QThread
{
Q_OBJECT
public:
Thread();
char buf[128];
volatile bool stopped;
volatile bool write_rs;
volatile bool read_rs;
protected:
virtual void run();
signals:
void finished();
};
#endif


thread.cpp :
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "thread.h"
#define BAUDRATE B9600
#define RS_DEVICE "/dev/ttySAC1"
Thread::Thread()
{}
void Thread::run()
{
int fd,res;
struct termios oldtio,newtio;
printf("start...\n");
fd=open(RS_DEVICE,O_RDWR|O_NOCTTY);
if(fd
#3 [得道之兔 05-15 11:36]
错误提示信息说是第几行出现错误?
#4 回 3楼(得道之兔) 的帖子 [caffee_1989 05-15 16:33]
是thread.h的第8行:
class Thread : public QThread这一行
#5 [得道之兔 05-17 09:35]
不好意思,我也看不出来。
如果确认不是拼写错误的话,可以考虑是否配置的问题。

<< 1 2 >> (1/2)

回复 发表
主题 版块