错误信息:
/home/qiang/projects/qt4/leds/leds.cpp:36: 错误: 对‘leds::open(const char [10], int)’的调用没有匹配的函数
/usr/local/Trolltech/QtEmbedded-4.5.1/include/QtGui/qdialog.h:99: 附注: 备选为: void QDialog::open()
源码:
leds.cpp
#include "leds.h"
#include "ui_leds.h"
//qiang
#include <linux/errno.h> //包含:ENODEV
#include <sys/fcntl.h> //包含设备操作函数:open,close...
#include <QMessageBox>
#define DEVICE_NAME "/dev/leds" //定义设备名:和驱动的对应好!
leds::leds(QWidget *parent)
: QDialog(parent), ui(new Ui::leds)
{
ui->setupUi(this);
//对话框初始化
ret=-ENODEV;
}
leds::~leds()
{
delete ui;
}
void leds::on_pushButton_Init_clicked()
{
fd = open(DEVICE_NAME,O_RDONLY); //打开设备:O_RDONLY-只读;O_RDWR:读写
}
void leds::on_pushButton_Led1On_clicked()
{
}
led.h
#ifndef LEDS_H
#define LEDS_H
#include <QtGui/QDialog>
namespace Ui
{
class leds;
}
class leds : public QDialog
{
Q_OBJECT
public:
leds(QWidget *parent = 0);
~leds();
private:
Ui::leds *ui;
private slots:
void on_pushButton_Init_clicked();
void on_pushButton_Led1On_clicked();
//qiang
public:
int ret;
int fd;
private:
};
#endif // LEDS_H