Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qextserialport library issue

Qextserialport library issue

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    roboterprogrammer
    wrote on last edited by
    #1

    Hello,

    I tried to include this
    http://code.google.com/p/qextserialport/wiki/QextSerialPort_1_2_Beta2

    but 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_OBJECT

    public:
    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 *.pro

    when 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]

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      You need to include QextSerialPort already in comport.h .

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved