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. identifier and initializer errors in extracted example code
Qt 6.11 is out! See what's new in the release blog

identifier and initializer errors in extracted example code

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 657 Views
  • 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.
  • A Offline
    A Offline
    agmar
    wrote on last edited by
    #1

    Hi,
    I keep getting this error on my code, but the same lines do not give an error in the terminal example...
    I have checked the other files for missed includes and the like, but I am at a dead end, whats the problem?

    9c9e35de-7e74-4e29-95b1-188d04ad7544-image.png
    my code^

    20aef12d-93e5-4332-bcde-71c92a88ab42-image.png
    code in the terminal example^

    JonBJ A 2 Replies Last reply
    0
    • A agmar

      Hi,
      I keep getting this error on my code, but the same lines do not give an error in the terminal example...
      I have checked the other files for missed includes and the like, but I am at a dead end, whats the problem?

      9c9e35de-7e74-4e29-95b1-188d04ad7544-image.png
      my code^

      20aef12d-93e5-4332-bcde-71c92a88ab42-image.png
      code in the terminal example^

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @agmar
      Show your mainwindow.h file, preferably as text rather than screenshot, indication where m_serial member is declared.

      A 1 Reply Last reply
      1
      • JonBJ JonB

        @agmar
        Show your mainwindow.h file, preferably as text rather than screenshot, indication where m_serial member is declared.

        A Offline
        A Offline
        agmar
        wrote on last edited by
        #3

        @JonB here it is #ifndef MAINWINDOW_H
        #define MAINWINDOW_H

        #include <QMainWindow>
        #include <QApplication>
        #include <QLabel>
        #include <QScrollArea>
        #include <QVBoxLayout>
        #include <QWidget>
        #include <QtSerialPort/QSerialPortInfo>
        #include <QtSerialPort>
        #include <QLineEdit>
        #include <QByteArray>

        #include <iostream>

        QT_BEGIN_NAMESPACE
        namespace Ui { class MainWindow; }
        QT_END_NAMESPACE

        class MainWindow : public QMainWindow
        {
        Q_OBJECT

        signals:
        void getData(const QByteArray &data);

        public:
        MainWindow(QWidget *parent = nullptr);
        ~MainWindow();
        void putData(const QByteArray &data);

        private slots:
        void sendMessage();
        void inputGet();
        void receiveMessage();
        void readData();
        void on_horizontalSlider_sliderReleased();

        private:
        Ui::MainWindow *ui;
        QLabel *label;

        };
        #endif // MAINWINDOW_H
        I know there is nothing here related to m_serial, but the terminal example has nothing as well...

        JonBJ 1 Reply Last reply
        0
        • A agmar has marked this topic as solved on
        • A agmar

          @JonB here it is #ifndef MAINWINDOW_H
          #define MAINWINDOW_H

          #include <QMainWindow>
          #include <QApplication>
          #include <QLabel>
          #include <QScrollArea>
          #include <QVBoxLayout>
          #include <QWidget>
          #include <QtSerialPort/QSerialPortInfo>
          #include <QtSerialPort>
          #include <QLineEdit>
          #include <QByteArray>

          #include <iostream>

          QT_BEGIN_NAMESPACE
          namespace Ui { class MainWindow; }
          QT_END_NAMESPACE

          class MainWindow : public QMainWindow
          {
          Q_OBJECT

          signals:
          void getData(const QByteArray &data);

          public:
          MainWindow(QWidget *parent = nullptr);
          ~MainWindow();
          void putData(const QByteArray &data);

          private slots:
          void sendMessage();
          void inputGet();
          void receiveMessage();
          void readData();
          void on_horizontalSlider_sliderReleased();

          private:
          Ui::MainWindow *ui;
          QLabel *label;

          };
          #endif // MAINWINDOW_H
          I know there is nothing here related to m_serial, but the terminal example has nothing as well...

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @agmar
          So like I said, standard C++, you need to declare the member variable you are trying to use....

          I cannot say about whatever example you have used since you do not give any link....

          1 Reply Last reply
          2
          • A agmar

            Hi,
            I keep getting this error on my code, but the same lines do not give an error in the terminal example...
            I have checked the other files for missed includes and the like, but I am at a dead end, whats the problem?

            9c9e35de-7e74-4e29-95b1-188d04ad7544-image.png
            my code^

            20aef12d-93e5-4332-bcde-71c92a88ab42-image.png
            code in the terminal example^

            A Offline
            A Offline
            agmar
            wrote on last edited by
            #5

            @JonB thank you, i just missed the line in the terminal example... its the example available in the welcome page :-) just type out "terminal" in the search bar

            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