Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. error: member access into incomplete type

error: member access into incomplete type

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++databasedesigndebugging
5 Posts 3 Posters 7 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    could somebody PLEASE explain to me and help me to understand the error. I can build and show the dialog object // build basic dialoog MainWindow_Bluewtoothctl_Dialog *MWBD = new MainWindow_Bluewtoothctl_Dialog(); MWBD->show(); however I cannot access its "ui" and getting the "incomplete error ". I build a local function and then have access to "ui". QT_BEGIN_NAMESPACE namespace Ui { class MainWindow_Bluewtoothctl_Dialog; } QT_END_NAMESPACE class MainWindow_Bluewtoothctl_Dialog : public QDialog { Q_OBJECT public: MainWindow_Bluewtoothctl_Dialog(QWidget *parent = nullptr); ~MainWindow_Bluewtoothctl_Dialog(); // adds BT_Utility_Library *BTUL; QString text; QString EditText(QString ); QString EditText(QString, QWidget*); QString EditText(QString, QWidget*, QWidget*); QString Command(QString ); private: public: Ui::MainWindow_Bluewtoothctl_Dialog *ui; };

    MainWindow_Bluewtoothctl_Dialog::MainWindow_Bluewtoothctl_Dialog(QWidget *parent)
    : QDialog(parent)
    , ui(new Ui::MainWindow_Bluewtoothctl_Dialog)
    {
    ui->setupUi(this);
    #ifdef TRACE
    text = " TASK MainWindow_Bluewtoothctl_Dialog ";
    text += " ";
    text += Q_FUNC_INFO;
    text += " @ line ";
    text += QString::number(__LINE__);
    //text += " TASK index ";
    //text += QString::number(index);
    qDebug() << text;
    ui->textEdit->append(text);
    #endif
    text = " Constructor...";
    ui->textEdit->append(" Constructor..."); // OK here
    }

    MainWindow_Bluewtoothctl_Dialog::~MainWindow_Bluewtoothctl_Dialog()
    {
    delete ui;
    }

    // build basic dialoog
    MainWindow_Bluewtoothctl_Dialog *MWBD = new MainWindow_Bluewtoothctl_Dialog();
    MWBD->show();

        // add function to bypass "INCOMPLETE WHATEVER
        text = " add function to bypass INCOMPLETE WHATEVER ";
        MWBD->EditText(text);
    
    
        // TEST ui
        MWBD->ui->textEdit->append(text);
    

    this fails with "incomplete error " why ?

    Here is full error:

    mainwindow.cpp:595:17: error: member access into incomplete type 'Ui::MainWindow_Bluewtoothctl_Dialog'
    MWBD->ui->textEdit->append(text);
    ^
    /mnt/07b7c3f8-0efb-45ab-8df8-2a468771de1f/BT_NOV26_BACKUP/BT_NOV26/FT857_CAT_Bluetooth/BluetoothctldIALOG_Object/Bluetoothctl_Dialog/mainwindow_bluewtoothctl_dialog.h:16:22: note: forward declaration of 'Ui::MainWi

    Richard Andrew x64R J 2 Replies Last reply
    0
    • L Lost User

      could somebody PLEASE explain to me and help me to understand the error. I can build and show the dialog object // build basic dialoog MainWindow_Bluewtoothctl_Dialog *MWBD = new MainWindow_Bluewtoothctl_Dialog(); MWBD->show(); however I cannot access its "ui" and getting the "incomplete error ". I build a local function and then have access to "ui". QT_BEGIN_NAMESPACE namespace Ui { class MainWindow_Bluewtoothctl_Dialog; } QT_END_NAMESPACE class MainWindow_Bluewtoothctl_Dialog : public QDialog { Q_OBJECT public: MainWindow_Bluewtoothctl_Dialog(QWidget *parent = nullptr); ~MainWindow_Bluewtoothctl_Dialog(); // adds BT_Utility_Library *BTUL; QString text; QString EditText(QString ); QString EditText(QString, QWidget*); QString EditText(QString, QWidget*, QWidget*); QString Command(QString ); private: public: Ui::MainWindow_Bluewtoothctl_Dialog *ui; };

      MainWindow_Bluewtoothctl_Dialog::MainWindow_Bluewtoothctl_Dialog(QWidget *parent)
      : QDialog(parent)
      , ui(new Ui::MainWindow_Bluewtoothctl_Dialog)
      {
      ui->setupUi(this);
      #ifdef TRACE
      text = " TASK MainWindow_Bluewtoothctl_Dialog ";
      text += " ";
      text += Q_FUNC_INFO;
      text += " @ line ";
      text += QString::number(__LINE__);
      //text += " TASK index ";
      //text += QString::number(index);
      qDebug() << text;
      ui->textEdit->append(text);
      #endif
      text = " Constructor...";
      ui->textEdit->append(" Constructor..."); // OK here
      }

      MainWindow_Bluewtoothctl_Dialog::~MainWindow_Bluewtoothctl_Dialog()
      {
      delete ui;
      }

      // build basic dialoog
      MainWindow_Bluewtoothctl_Dialog *MWBD = new MainWindow_Bluewtoothctl_Dialog();
      MWBD->show();

          // add function to bypass "INCOMPLETE WHATEVER
          text = " add function to bypass INCOMPLETE WHATEVER ";
          MWBD->EditText(text);
      
      
          // TEST ui
          MWBD->ui->textEdit->append(text);
      

      this fails with "incomplete error " why ?

      Here is full error:

      mainwindow.cpp:595:17: error: member access into incomplete type 'Ui::MainWindow_Bluewtoothctl_Dialog'
      MWBD->ui->textEdit->append(text);
      ^
      /mnt/07b7c3f8-0efb-45ab-8df8-2a468771de1f/BT_NOV26_BACKUP/BT_NOV26/FT857_CAT_Bluetooth/BluetoothctldIALOG_Object/Bluetoothctl_Dialog/mainwindow_bluewtoothctl_dialog.h:16:22: note: forward declaration of 'Ui::MainWi

      Richard Andrew x64R Offline
      Richard Andrew x64R Offline
      Richard Andrew x64
      wrote on last edited by
      #2

      I think it's telling you that the type represented by ui has not been completely declared. Make sure you are #including the header files for all the types you are using.

      The difficult we do right away... ...the impossible takes slightly longer.

      L 1 Reply Last reply
      0
      • L Lost User

        could somebody PLEASE explain to me and help me to understand the error. I can build and show the dialog object // build basic dialoog MainWindow_Bluewtoothctl_Dialog *MWBD = new MainWindow_Bluewtoothctl_Dialog(); MWBD->show(); however I cannot access its "ui" and getting the "incomplete error ". I build a local function and then have access to "ui". QT_BEGIN_NAMESPACE namespace Ui { class MainWindow_Bluewtoothctl_Dialog; } QT_END_NAMESPACE class MainWindow_Bluewtoothctl_Dialog : public QDialog { Q_OBJECT public: MainWindow_Bluewtoothctl_Dialog(QWidget *parent = nullptr); ~MainWindow_Bluewtoothctl_Dialog(); // adds BT_Utility_Library *BTUL; QString text; QString EditText(QString ); QString EditText(QString, QWidget*); QString EditText(QString, QWidget*, QWidget*); QString Command(QString ); private: public: Ui::MainWindow_Bluewtoothctl_Dialog *ui; };

        MainWindow_Bluewtoothctl_Dialog::MainWindow_Bluewtoothctl_Dialog(QWidget *parent)
        : QDialog(parent)
        , ui(new Ui::MainWindow_Bluewtoothctl_Dialog)
        {
        ui->setupUi(this);
        #ifdef TRACE
        text = " TASK MainWindow_Bluewtoothctl_Dialog ";
        text += " ";
        text += Q_FUNC_INFO;
        text += " @ line ";
        text += QString::number(__LINE__);
        //text += " TASK index ";
        //text += QString::number(index);
        qDebug() << text;
        ui->textEdit->append(text);
        #endif
        text = " Constructor...";
        ui->textEdit->append(" Constructor..."); // OK here
        }

        MainWindow_Bluewtoothctl_Dialog::~MainWindow_Bluewtoothctl_Dialog()
        {
        delete ui;
        }

        // build basic dialoog
        MainWindow_Bluewtoothctl_Dialog *MWBD = new MainWindow_Bluewtoothctl_Dialog();
        MWBD->show();

            // add function to bypass "INCOMPLETE WHATEVER
            text = " add function to bypass INCOMPLETE WHATEVER ";
            MWBD->EditText(text);
        
        
            // TEST ui
            MWBD->ui->textEdit->append(text);
        

        this fails with "incomplete error " why ?

        Here is full error:

        mainwindow.cpp:595:17: error: member access into incomplete type 'Ui::MainWindow_Bluewtoothctl_Dialog'
        MWBD->ui->textEdit->append(text);
        ^
        /mnt/07b7c3f8-0efb-45ab-8df8-2a468771de1f/BT_NOV26_BACKUP/BT_NOV26/FT857_CAT_Bluetooth/BluetoothctldIALOG_Object/Bluetoothctl_Dialog/mainwindow_bluewtoothctl_dialog.h:16:22: note: forward declaration of 'Ui::MainWi

        J Offline
        J Offline
        JudyL_MD
        wrote on last edited by
        #3

        You need to work on your google foo -- this was the first result when I searched on "access into incomplete type" and it has a very good explanation of the problem https://stackoverflow.com/questions/19962812/error-member-access-into-incomplete-type-forward-declaration-of[^]

        Be wary of strong drink. It can make you shoot at tax collectors - and miss. Lazarus Long, "Time Enough For Love" by Robert A. Heinlein

        1 Reply Last reply
        0
        • Richard Andrew x64R Richard Andrew x64

          I think it's telling you that the type represented by ui has not been completely declared. Make sure you are #including the header files for all the types you are using.

          The difficult we do right away... ...the impossible takes slightly longer.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Many thanks, my own fault...missed ui header. I always forget to add the "ui...." header created by QT... The "forward note" error was not too helpful either. #include "ui_mainwindow_bluewtoothctl_dialog.h"

          Richard Andrew x64R 1 Reply Last reply
          0
          • L Lost User

            Many thanks, my own fault...missed ui header. I always forget to add the "ui...." header created by QT... The "forward note" error was not too helpful either. #include "ui_mainwindow_bluewtoothctl_dialog.h"

            Richard Andrew x64R Offline
            Richard Andrew x64R Offline
            Richard Andrew x64
            wrote on last edited by
            #5

            Glad I was able to help!

            The difficult we do right away... ...the impossible takes slightly longer.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups