Qextserialport library issue
-
Hello,
I tried to include this
http://code.google.com/p/qextserialport/wiki/QextSerialPort_1_2_Beta2but i dont know how to declare
@ QextSerialPort *pport("COM");
@
in the headerfile.i have the headerfile:
@#ifndef COMPORT_H
#define COMPORT_H
#include <QMainWindow>namespace Ui {
class comport;
}class comport : public QMainWindow
{
Q_OBJECTpublic:
explicit comport(QWidget *parent = 0);
~comport();
QextSerialPort *pport("COM");public slots:
void onDataAvailable();
void MyClass();
private:
Ui::comport *ui;
};#endif // COMPORT_H
@and cpp file
@#include "comport.h"
#include "ui_comport.h"
#include "qextserialport.h"comport::comport(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::comport)
{
ui->setupUi(this);
}comport::~comport()
{
delete ui;
}...
comport::MyClass()
{
// port = new QextSerialPort("COM1");
// connect(port, SIGNAL(readyRead()), this, SLOT(onDataAvailable()));
// port->open();
}void comport::onDataAvailable()
{
// QByteArray data = port->readAll();
// processNewData(usbdata);
}
@and included
include(C:\qextserialport\qextserialport.pri)
to the project file *.prowhen i want to compile i get
@C:\Dokumente und Einstellungen\remy\Desktop\qextserialport-1.2beta2\com_port-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug..\com_port\comport.h:16: Fehler:ISO C++ forbids declaration of 'QextSerialPort' with no type
@s.o. knows how to declare it right in the headerfile?
thanks
[edit: code tags corrected, koahnig]
-
You need to include QextSerialPort already in comport.h .