Ошибка invalid use of incomplete type class qdebug

solmaxa

17 / 8 / 2

Регистрация: 06.01.2013

Сообщений: 163

1

08.01.2013, 21:29. Показов 11520. Ответов 2

Метки нет (Все метки)


Студворк — интернет-сервис помощи студентам

В первой строке ошибки нет (vec3d — структура Opencv), во второй редактор выдает:

C++ (Qt)
1
2
          int bgrPixel = img1.at<Vec3b>(i, j)[0];//b
            QDebug("%d",bgrPixel);

ошибка: invalid use of incomplete type ‘class QDebug’



0



NoMasters

Псевдослучайный

1946 / 1145 / 98

Регистрация: 13.09.2011

Сообщений: 3,215

08.01.2013, 22:40

2

А что это вы с ним такое пытаетесь сделать? Подозреваю, что подразумевалось нечто вроде

C++ (Qt)
1
qDebug() << bgrPixel



1



solmaxa

17 / 8 / 2

Регистрация: 06.01.2013

Сообщений: 163

09.01.2013, 20:45

 [ТС]

3

))))

C++ (Qt)
1
#include <QDebug>



0



New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account

Closed

balogic opened this issue

Mar 22, 2017

· 11 comments

Comments

@balogic

I got this issue while trying to build tensor in my Ubuntu machine

selection_029

OS — Ubuntu
Version — 16.04

@KitsuneRal

It seems that ConnectionData doesn’t include <QDebug> though it has to — this is actually the libqmatrixclient code, used by Tensor and Quaternion. I wonder which version of Qt you have and which compiler you’re building with — I haven’t seen this error message before. Anyway, thanks for reporting.

@KitsuneRal

Looking further into your case, I see that <QDebug> might actually be not included from the depths of Qt header files in case when QT_NO_DEBUG_STREAM is defined. But in that case, I’m afraid, you’ll get more unrecoverable errors even if you just throw #include <QDebug> into connectiondata.cpp.

@balogic

@KitsuneRal

@balogic , qmake is a separate tool that has its own versioning. Did you install Qt from PPA or do you use the stock Qt (5.5?) version installed with 16.04?
So far I cannot even reproduce the build problem that you have. It builds fine on my Ubuntu VM.

@balogic

@KitsuneRal I haven’t installed Qt5 explicitly but I have all the build
tools needed. Doesn’t Ubuntu comes with Qt by default? Does missing
Qt5 is actually the issue?

@KitsuneRal

To be on the safe side, please do the following:
sudo apt-get install git cmake qtdeclarative5-dev qtdeclarative5-qtquick2-plugin qtdeclarative5-controls-plugin
This should install all dependencies you may need.

@balogic

@KitsuneRal I’ve installed it all. But still the same error persists.

@KitsuneRal

I’m out of ideas. Anyway, since in all fairness we actually use qDebug() in this file, I’m adding a commit with #include <QDebug> to libqmatrixclient now. Can you please do the same (add #include <QDebug> to other #includes in the file connectiondata.cpp), to see that this resolves your problem?

@balogic

Now the error changes to QtCore/QJsonObject No such file or directory

selection_030

@KitsuneRal

I just noticed — does it try to compile against Qt 4 instead of Qt 5? Do you actually need Qt 4 on your system?

@davidar

I just got bitten by this, apparently Ubuntu changed the qmake default from qt5 to qt4 at some point… :/

sudo apt install qt5-default fixes it

I know there has been tons of questions like that, but unfortunately after hours of googling and browsing through all of them, none of the answers I read helped. Therefore I am making my own version of my question. The error message I get is: «error: invalid use of incomplete type ‘std::iterator_traits::value_type {aka class Cell}’» My code:

cell.h

#ifndef CELL_H
#define CELL_H

#include <QPushButton>
#include <QMouseEvent>
#include <vector>

class Padding;

class Cell : public QPushButton
{
    Q_OBJECT

    public:

        friend class Padding;
        Cell(int x, int y, Padding* padding, QWidget* parent = 0) : QPushButton(parent), x(x), y(y),
            padding(padding)
        {
            setFixedSize(20, 20);
        }
        Cell(const Cell& object) : QPushButton(), x(object.x), y(object.y), padding(object.padding)
        {
            setFixedSize(20, 20);
        }
        int getX() { return x; };
        int getY() { return y; };
        bool hasMine() { return mine; };
        void setHasMine(bool mine) { this -> mine = mine; };
        bool isFlagged() { return flagged; };
        bool didExplode() { return exploded; };
        bool getHasBeenClicked() { return hasBeenClicked; };
        void clicked();
        ~Cell() {};
        Cell operator=(const Cell& object)
        {
            if(&object == this)
            {
                return *this;
            }
            padding = object.padding;
            x = object.x;
            y = object.y;
            mine = object.mine;
            flagged = object.flagged;
            exploded = object.exploded;
            hasBeenClicked = object.hasBeenClicked;
            setFixedSize(20, 20);
            return *this;
        }

    private:

        Padding* padding;
        int x;
        int y;
        bool mine = false;
        bool flagged = false;
        bool exploded = false;
        bool hasBeenClicked = false;
        void mousePressEvent(QMouseEvent* e);
        void rightClicked();
};

#endif // CELL_H

cell.cpp

#include "cell.h"
#include "padding.h"

void Cell::mousePressEvent(QMouseEvent* event)
{
    if(event -> button() == Qt::LeftButton)
    {
        clicked();
    }
    else if(event -> button() == Qt::RightButton)
    {
        rightClicked();
    }
}

void Cell::clicked()
{
    hasBeenClicked = true;
    // TODO: Set the button frame to flat. DONE.
    setFlat(true);
    // TODO: Make the button not click able. DONE.
    setEnabled(false);
    // TODO: Display appropriate number on the button, or mine and end the game. DONE.
    if(mine)
    {
        // TODO: Send game over signal and end the game.
        //setIcon(QIcon("mine_clicked.png"));
        setText("/");
        exploded = true;
        padding -> gameOver();
    }
    else
    {
        setText(QString::number(padding -> countMinesAround(this)));
    }
    if(padding -> countMinesAround(this) == 0)
    {
        // Trigger chain reaction; uncover many neighboring cells, if they are not mines.
        padding -> triggerChainReactionAround(this);
    }
}

void Cell::rightClicked()
{
    if(text() != "f")
    {
        setText("f");
        (padding -> minesLeft)--;
    }
    else
    {
        setText("");
        (padding -> minesLeft)++;
    }
    flagged = !flagged;
}

padding.h

#ifndef PADDING_H
#define PADDING_H

#include <QWidget>
#include <QGridLayout>
#include <vector>

class Cell;

class Padding : public QWidget
{
    Q_OBJECT

    public:

        friend class Cell;

        enum class Difficulty
        {
            Beginner,
            Intermediate,
            Advanced,
            Custom
        };

        Padding(QWidget* parent = 0);
        void newGame();
        void gameOver();
        void setLevel(Padding::Difficulty difficulty) { this -> difficulty = difficulty; };
        void setPaddingHeight(int height) { paddingHeight = height; };
        void setPaddingWidth(int width) { paddingWidth = width; };
        void setMines(int mines) { this -> mines = mines; };
        int getMinesLeft() { return minesLeft; };
        ~Padding() {};

    private:

        struct DifficultyLevelsProperties
        {
            struct BeginnerProperties
            {
                const int PADDING_HEIGHT = 9;
                const int PADDING_WIDTH = 9;
                const int MINES = 10;
            } Beginner;

            struct IntermediateProperties
            {
                const int PADDING_HEIGHT = 16;
                const int PADDING_WIDTH = 16;
                const int MINES = 40;
            } Intermediate;

            struct AdvancedProperties
            {
                const int PADDING_HEIGHT = 16;
                const int PADDING_WIDTH = 40;
                const int MINES = 99;
            } Advanced;
        } LevelProperties;

        Difficulty difficulty = Difficulty::Beginner;
        int paddingHeight;
        int paddingWidth;
        int mines;
        // Mines that are not flagged.
        int minesLeft;
        // Time in seconds since the game was started.
        int secondsSinceStart;
        std::vector<Cell> cells;
        QGridLayout* paddingLayout;
        const int CELLS_HEIGHT = 20;
        const int CELLS_WIDTH = 20;
        int countMinesAround(Cell*);
        void triggerChainReactionAround(Cell*);
        void updateSecondsSinceStart();
};

#endif // PADDING_H

padding.cpp

#include "padding.h"
#include <QGridLayout>
#include <QTimer>
#include <QTime>
#include <QDebug>
#include "cell.h"

Padding::Padding(QWidget* parent) : QWidget(parent)
{
    newGame();
    paddingLayout = new QGridLayout(this);
    paddingLayout -> setSpacing(0);
}

void Padding::newGame()
{
    if(difficulty == Padding::Difficulty::Beginner)
    {
        paddingHeight = LevelProperties.Beginner.PADDING_HEIGHT;
        paddingWidth = LevelProperties.Beginner.PADDING_WIDTH;
        mines = LevelProperties.Beginner.MINES;
    }
    else if(difficulty == Padding::Difficulty::Intermediate)
    {
        paddingHeight = LevelProperties.Intermediate.PADDING_HEIGHT;
        paddingWidth = LevelProperties.Intermediate.PADDING_WIDTH;
        mines = LevelProperties.Intermediate.MINES;
    }
    else if(difficulty == Padding::Difficulty::Advanced)
    {
        paddingHeight = LevelProperties.Advanced.PADDING_HEIGHT;
        paddingWidth = LevelProperties.Advanced.PADDING_WIDTH;
        mines = LevelProperties.Advanced.MINES;
    }
    minesLeft = mines;
    cells.clear();
    for(int i = 0; i < paddingHeight; i++)
    {
        for(int j = 0; j < paddingWidth; j++)
        {
            // TODO: Use smart pointers instead of raw pointers.
            Cell* cell = new Cell(j + 1, i + 1, this);
            cells.push_back(*cell);
            delete cell;
        }
    }
    qsrand(QTime::currentTime().msec());
    for(int i = 0; i < mines; i++)
    {
        // TODO: Fix the randomness of the numbers. DONE.
        cells[qrand() % (paddingHeight * paddingWidth) + 1].setHasMine(true);
    }
    for(int i = 0; i < cells.size(); i++)
    {
        paddingLayout -> addWidget(&cells[i], cells[i].getY(), cells[i].getX());
    }
}

void Padding::gameOver()
{
    for(int i = 0; i < cells.size(); i++)
    {
        cells[i].setEnabled(false);
        if((cells[i].hasMine()) && (!cells[i].getHasBeenClicked()))
        {
            cells[i].clicked();
        }
    }
}

int Padding::countMinesAround(Cell*)
{
    int minesCounter = 0;
    for(int i = 0; i < cells.size(); i++)
    {
        qDebug() << QString::number(cells[i].getX());
        if(((x - cells[i].getX() == 0) || (x - cells[i].getX() == 1) || (x -
            cells[i].getX() == -1)) && ((y - cells[i].getY() == 0) || (y -
            cells[i].getY() == 1) || (y - cells[i].getY() == -1)) &&
            (cells[i].hasMine()))
        {
            minesCounter++;
        }
    }
    return minesCounter;
}

void Padding::triggerChainReactionAround(Cell*)
{
    for(int i = 0; i < cells.size(); i++)
    {
        if(((x - cells[i].getX() == 0) || (x - cells[i].getX() == 1) || (x -
            cells[i].getX() == -1)) && ((y - cells[i].getY() == 0) || (y -
            cells[i].getY() == 1) || (y - cells[i].getY() == -1)) &&
            (!cells[i].getHasBeenClicked()))
        {
            cells[i].clicked();
        }
    }
}

Sorry for how long the whole thing, but I could not shorten it as I can’t locate what causes the error. Also please ignore any TODO’s or any lines that are commented out and I forgot to delete them. Please help!

solmaxa

17 / 8 / 2

Регистрация: 06.01.2013

Сообщений: 163

1

08.01.2013, 21:29. Показов 10910. Ответов 2

Метки нет (Все метки)


В первой строке ошибки нет (vec3d — структура Opencv), во второй редактор выдает:

C++ (Qt)
1
2
          int bgrPixel = img1.at<Vec3b>(i, j)[0];//b
            QDebug("%d",bgrPixel);

ошибка: invalid use of incomplete type ‘class QDebug’

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь

0

NoMasters

Псевдослучайный

1946 / 1145 / 98

Регистрация: 13.09.2011

Сообщений: 3,215

08.01.2013, 22:40

2

А что это вы с ним такое пытаетесь сделать? Подозреваю, что подразумевалось нечто вроде

C++ (Qt)
1
qDebug() << bgrPixel

1

solmaxa

17 / 8 / 2

Регистрация: 06.01.2013

Сообщений: 163

09.01.2013, 20:45

 [ТС]

3

))))

C++ (Qt)
1
#include <QDebug>

0

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account


Closed

balogic opened this issue

Mar 22, 2017

· 11 comments

Comments

@balogic

I got this issue while trying to build tensor in my Ubuntu machine

selection_029

OS — Ubuntu
Version — 16.04

@KitsuneRal

It seems that ConnectionData doesn’t include <QDebug> though it has to — this is actually the libqmatrixclient code, used by Tensor and Quaternion. I wonder which version of Qt you have and which compiler you’re building with — I haven’t seen this error message before. Anyway, thanks for reporting.

@KitsuneRal

Looking further into your case, I see that <QDebug> might actually be not included from the depths of Qt header files in case when QT_NO_DEBUG_STREAM is defined. But in that case, I’m afraid, you’ll get more unrecoverable errors even if you just throw #include <QDebug> into connectiondata.cpp.

@balogic

@KitsuneRal

@balogic , qmake is a separate tool that has its own versioning. Did you install Qt from PPA or do you use the stock Qt (5.5?) version installed with 16.04?
So far I cannot even reproduce the build problem that you have. It builds fine on my Ubuntu VM.

@balogic

@KitsuneRal I haven’t installed Qt5 explicitly but I have all the build
tools needed. Doesn’t Ubuntu comes with Qt by default? Does missing
Qt5 is actually the issue?

@KitsuneRal

To be on the safe side, please do the following:
sudo apt-get install git cmake qtdeclarative5-dev qtdeclarative5-qtquick2-plugin qtdeclarative5-controls-plugin
This should install all dependencies you may need.

@balogic

@KitsuneRal I’ve installed it all. But still the same error persists.

@KitsuneRal

I’m out of ideas. Anyway, since in all fairness we actually use qDebug() in this file, I’m adding a commit with #include <QDebug> to libqmatrixclient now. Can you please do the same (add #include <QDebug> to other #includes in the file connectiondata.cpp), to see that this resolves your problem?

@balogic

Now the error changes to QtCore/QJsonObject No such file or directory

selection_030

@KitsuneRal

I just noticed — does it try to compile against Qt 4 instead of Qt 5? Do you actually need Qt 4 on your system?

@davidar

I just got bitten by this, apparently Ubuntu changed the qmake default from qt5 to qt4 at some point… :/

sudo apt install qt5-default fixes it

Почему выпадает ошибка в такой записи:

QList<QString> list;
list << "AAAA" << "BBBB" << "CCCC";

QListIterator<QString> it(list);

while(it.hasNext())
{
    QDebug() << "Element: " << it.next();
}

error: invalid use of incomplete type ‘struct QDebug’
forward declaration of ‘struct QDebug’

cy6erGn0m's user avatar

cy6erGn0m

19.6k1 золотой знак31 серебряный знак37 бронзовых знаков

задан 28 июн 2011 в 19:28

STERLIN's user avatar

Думаю, вы не подключили QDebug.

#include <QDebug>

ответ дан 28 июн 2011 в 19:30

cy6erGn0m's user avatar

cy6erGn0mcy6erGn0m

19.6k1 золотой знак31 серебряный знак37 бронзовых знаков

1

Details


    • Type:


      Bug

    • Status:

      Closed


    • Priority:


      P0: Blocker

    • Resolution:

      Done


    • Affects Version/s:



      5.11.0 Alpha


    • Environment:

      Linux openSUSE_42_3 (gcc-x86_64) — DeveloperBuild, NoPch, AbortTestingOnFirstFailure

      Linux openSUSE_42_3 (icc_18-x86_64) — DeveloperBuild, NoPch, DisableTests, SystemSQLite, AbortTestingOnFirstFailure


    • Commits:

      a79d9da8e0bbc69053d00dd1ff1dd55c47258291

    Description

      Gerrit Reviews


      No reviews matched the request. Check your Options in the drop-down menu of this sections header.

      Activity

        Problem:

        You are compiling a C/C++ program using GCC. You get an error message similar to this:

        error: invalid use of incomplete type ‘class SomeType’
        

        Solution:

        There are multiple possible issues, but in general this error means that GCC can’t find the full declaration of the given class or struct.

        The most common issue is that you are missing an #include clause. Find out in which header file the declaration resides, i.e. if the error message mentions class Map, look for something like

        class Map {
           // ...
        };

        Usually the classes reside in header files that are similar to their name, e.g. MyClass might reside in a header file that is called MyClass.h, MyClass.hpp or MyClass.hxx, so be sure to look for those files first. Note that you might also be looking for a type from a library. Often the best approach is to google C++ <insert the missing type here> to find out where it might be located.

        Another possible reason is that you have your #include clause after the line where the error occurs. If this is the case, ensure that all required types are included before they are used.

        For other reasons, see StackOverflow, e.g. this post

        Автор Тема: invalid use of incomplete type (решено)  (Прочитано 24680 раз)
        theorist

        Гость


        здравствуйте!
        оказался в тупике, хотя решение, наверняка, насколько простое, что сам, наверное, буду долго смеяться …

        итак, пытаюсь в Qt Creator сделать программу, а вместо неё получаю следующее:

        …/mainwindow.cpp:38: ошибка: invalid use of incomplete type ‘struct TableModel’
        …/mainwindow.h:11: ошибка: forward declaration of ‘struct TableModel’
        …/mainwindow.cpp:39: ошибка: нет подходящей функции для вызова ‘QTableView::setModel(TableModel*&)’

        сам код такой:


        //mainwindow.cpp

        #include <QTableView>

        #include «mainwindow.h»
        #include «tablemodel.h»

        MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        {
        createCentralWdgt();

        }

        void MainWindow::createCentralWdgt()
        {
        tableView = new QTableView();
        tableModel = new TableModel();
        tableView->setModel(tableModel);
        setCentralWidget(tableView);
        }


        //mainwindow.h

        #include <QtGui/QMainWindow>

        class QTableView;
        class TableModel;

        class MainWindow : public QMainWindow
        {
        Q_OBJECT
        public:
        MainWindow(QWidget *parent = 0);

        private:

        QTableView *tableView;
        TableModel *tableModel;

        void createCentralWdgt();

        };


        //tablemodel.h

        #include <QAbstractTableModel>

        class TableModel : public QAbstractTableModel
        {
        Q_OBJECT
        public:
        TableModel(QObject* = 0);
        int rowCount(const QModelIndex& = QModelIndex()) const;
        int columnCount(const QModelIndex& = QModelIndex()) const;
        QVariant data(const QModelIndex&, int = Qt::DisplayRole) const;
        QVariant headerData(int, Qt::Orientation, int = Qt::DisplayRole) const;
        Qt::ItemFlags flags(const QModelIndex&) const;
        bool insertRows(int, int, const QModelIndex& = QModelIndex());
        bool removeRows(int, int, const QModelIndex& = QModelIndex());
        bool insertColumns(int, int, const QModelIndex& = QModelIndex());
        bool removeColumns(int, int, const QModelIndex& = QModelIndex());

        };


        //tablemodel.cpp

        #include «tablemodel.h»

        TableModel::TableModel(QObject *parent) : QAbstractTableModel(parent) {…}
        int TableModel::rowCount(const QModelIndex &parent) const {…}
        int TableModel::columnCount(const QModelIndex &parent) const {…}
        QVariant TableModel::data(const QModelIndex &index, int role) const {…}
        QVariant TableModel::headerData(int section, Qt::Orientation orientation, int role) const {…}
        Qt::ItemFlags TableModel::flags(const QModelIndex &index) const {…}
        bool TableModel::insertRows(int position, int rows, const QModelIndex &index) {…}
        bool TableModel::removeRows(int position, int rows, const QModelIndex &index) {…}
        bool TableModel::insertColumns(int position, int columns, const QModelIndex &index) {…}
        bool TableModel::removeColumns(int position, int columns, const QModelIndex &index) {…}

        прошу помощи  Непонимающий

        « Последнее редактирование: Июнь 02, 2010, 19:43 от theorist »
        Записан
        ритт

        Гость


        а весь файл tablemodel.h можно?


        Записан
        theorist

        Гость


        а весь файл tablemodel.h можно?

        конечно, хотя, в принципе, он практически соответствует уже выложенному. вот:

        #ifndef MAINWINDOW_H
        #define MAINWINDOW_H

        #include <QAbstractTableModel>

        class TableModel : public QAbstractTableModel
        {
        Q_OBJECT
        public:
        TableModel(QObject* = 0);
        int rowCount(const QModelIndex& = QModelIndex()) const;
        int columnCount(const QModelIndex& = QModelIndex()) const;
        QVariant data(const QModelIndex&, int = Qt::DisplayRole) const;
        QVariant headerData(int, Qt::Orientation, int = Qt::DisplayRole) const;
        Qt::ItemFlags flags(const QModelIndex&) const;
        bool insertRows(int, int, const QModelIndex& = QModelIndex());
        bool removeRows(int, int, const QModelIndex& = QModelIndex());
        bool insertColumns(int, int, const QModelIndex& = QModelIndex());
        bool removeColumns(int, int, const QModelIndex& = QModelIndex());
        private:
        QList<QStringList> array;
        };

        #endif // MAINWINDOW_H


        Записан
        Rcus

        Гость


        Copy-paste умеет не только ракеты ронять.
        Copy-paste умеет не только ракеты ронять

        /* смотрит на include guards */


        Записан
        theorist

        Гость


        Copy-paste умеет не только ракеты ронять.
        Copy-paste умеет не только ракеты ронять

        /* смотрит на include guards */

        спасибо! я же говорил, что сам буду смеяться  Смеющийся


        Записан
        theorist

        Гость


        Не понял, прошу объяснить где ошибка (я ее не нашел)

        #ifndef MAINWINDOW_H
        #define MAINWINDOW_H

        #endif // MAINWINDOW_H

        а файл называется tablemodel.h. правда, смешно? Веселый


        Записан
        ритт

        Гость


        почему и просил весь файл…


        Записан
        theorist

        Гость


        почему и просил весь файл…

        спасибо за наводку, Константин! но без дополнительной подсказки я бы, наверное, ни за что не догадался бы, что причина проблемы кроется именно в директивах препроцессора. впредь буду обращать на них больше внимания.

        думаю, что тему лучше перенести в раздел «Программирование: C/C++»


        Записан
        Igors

        #ifndef MAINWINDOW_H
        #define MAINWINDOW_H

        #endif // MAINWINDOW_H

        а файл называется tablemodel.h. правда, смешно? Веселый

        Спасибо, теперь понял  Улыбающийся


        Записан
        Mityai

        Гость


        Ребят, спасибо большое за эту тему! Я наконец-то понял как QTableView связать с QAbstractTableModel Смеющийся


        Записан
        dee

        Гость


        Была аналогичная проблема.

        Оказалось, при изменении objectName кнопки на форме (при магическом стечении обстоятельств по радиусу кривизны рук) была переименована не кнопка, а вся форма, в результате чего вылетало такое сообщение об ошибке.

        Мораль:
        БУДЬ ВНИМАТЕЛЕН!


        Записан

        Заголовочные файлы надо писать так, чтобы порядок их подключения был неважен.

        В реализации подключать первым собственный заголовочник — правильная идея; так мы убеждаемся, что в заголовочнике нет недостающих зависимостей.

        Совать #include в пространство имён без хорошего обоснования не стоит.

        По вашему обтекаемому описанию не видно, как устроены ваши заголовки, именованное пространство имён или нет, закрыты ли все скобки в хедерах, и т.д. Но причина ошибки очевидна: из-за пространств имён компилятор не отождествил классы в первом и втором заголовке; предварительное объявление «class A;» осталось неразрешённым. Поэкспериментировав, я выяснил вот что.

        // Не компилируется!
        class A;
        
        namespace XXX {
            std::shared_ptr<A> a;
            class A { public: int x; };
            void xxx();
        }
        
        void XXX::xxx() {
            a->x;
        }
        // Компилируется!
        class A;
        
        namespace XXX {
            class A { public: int x; };
            std::shared_ptr<A> a;
            void xxx();
        }
        
        void XXX::xxx() {
            a->x;
        }
        // Тоже компилируется!
        namespace XXX {
            class A;
        }
        
        namespace XXX {
            std::shared_ptr<A> a;
            class A { public: int x; };
            void xxx();
        }
        
        void XXX::xxx() {
            a->x;
        }

        В первом случае shared_ptr<::A>, который, естественно, не определён (есть XXX::A).
        Во втором — определение наперёд ::A вообще ни на что не сдалось; используется shared_ptr<XXX::A>.
        В третьем примере только один тип, XXX::A.

        Если первым идёт не использование, а make_shared — выходит другая ошибка, не удаётся получить sizeof недоопределённого типа A.

        Bug 666998
        x11-misc/albert-0.14.22 : /…/telemetry.cpp:83:24: error: invalid use of incomplete type class QDebug

        Summary:

        x11-misc/albert-0.14.22 : /…/telemetry.cpp:83:24: error: invalid use of inc…

        Status: RESOLVED
        FIXED

        Alias:

        None

        Product:

        Gentoo Linux

        Classification:

        Unclassified

        Component:

        Current packages

        (show other bugs)

        Hardware:

        All
        Linux

        Importance:

        Normal
        normal
        (vote)

        Assignee:

        Michael Palimaka (kensington)

        URL:


        Whiteboard:

        Keywords:

        Depends on:


        Blocks:



        qt-5.11
          Show dependency tree
        Reported: 2018-09-24 17:30 UTC by Toralf Förster
        Modified: 2018-10-11 12:13 UTC
        (History)

        CC List:

        0
        users

        See Also:

        Package list:

        Runtime testing required:


        Attachments

        emerge-info.txt


        (emerge-info.txt,16.75 KB,
        text/plain)

        2018-09-24 17:30 UTC,

        Toralf Förster

        Details

        emerge-history.txt


        (emerge-history.txt,221.92 KB,
        text/plain)

        2018-09-24 17:30 UTC,

        Toralf Förster

        Details

        environment


        (environment,117.29 KB,
        text/plain)

        2018-09-24 17:30 UTC,

        Toralf Förster

        Details

        etc.portage.tbz2


        (etc.portage.tbz2,23.79 KB,
        application/x-bzip)

        2018-09-24 17:30 UTC,

        Toralf Förster

        Details

        logs.tbz2


        (logs.tbz2,4.55 KB,
        application/x-bzip)

        2018-09-24 17:30 UTC,

        Toralf Förster

        Details

        temp.tbz2


        (temp.tbz2,30.93 KB,
        application/x-bzip)

        2018-09-24 17:30 UTC,

        Toralf Förster

        Details

        x11-misc:albert-0.14.22:20180924-154022.log


        (x11-misc:albert-0.14.22:20180924-154022.log,83.01 KB,
        text/plain)

        2018-09-24 17:30 UTC,

        Toralf Förster

        Details

        View All

        Add an attachment
        (proposed patch, testcase, etc.)

        Note
        You need to
        log in
        before you can comment on or make changes to this bug.


        Calling ‘debug’ with incomplete return type ‘QDebug’

        I’m trying to learn how to create GUIs with QT in c++ using this playlist.

        I can’t get through the second tutorial, however, as qDebug is not working. I get the error in the title in my code, and the error

        error: invalid use of incomplete type 'class QDebug'
                 qDebug() << "MyRect knows that you pressed a key";
                        ^     

        When trying to run the code. What is this, and how can I fix this?

        Archived post. New comments cannot be posted and votes cannot be cast.

      • Ошибка invalid stfs package horizon что делать
      • Ошибка invalid start mode archive offset что делать
      • Ошибка invalid signature detected check secure boot policy in setup как исправить
      • Ошибка invalid sid 1113 вконтакте
      • Ошибка invalid samp file