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
Forum Updated to NodeBB v4.3 + New Features

identifier and initializer errors in extracted example code

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 276 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 7 Feb 2023, 11:23 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^

    J A 2 Replies Last reply 7 Feb 2023, 11:49
    0
    • A agmar
      7 Feb 2023, 11:23

      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^

      J Offline
      J Offline
      JonB
      wrote on 7 Feb 2023, 11:49 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 7 Feb 2023, 11:57
      1
      • J JonB
        7 Feb 2023, 11:49

        @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 7 Feb 2023, 11:57 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...

        J 1 Reply Last reply 7 Feb 2023, 12:05
        0
        • A agmar has marked this topic as solved on 7 Feb 2023, 12:01
        • A agmar
          7 Feb 2023, 11:57

          @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...

          J Offline
          J Offline
          JonB
          wrote on 7 Feb 2023, 12:05 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
            7 Feb 2023, 11:23

            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 7 Feb 2023, 12:08 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

            1/5

            7 Feb 2023, 11:23

            • Login

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