0

I'm having a very serious issue with QT Creator. I can no longer use pointers to other classes and autocompletion doesn't work in my primary class. It feels like something has become corrupt, but all my code was working with a few pointers existing, then all at once none of them worked and errored out.

Line 21: InkPuppet *pointerToPuppet; errors: x:\development\inkpuppet\newdialog.h:21: error: C2143: syntax error : missing ';' before '*' and x:\development\inkpuppet\newdialog.h:21: error: C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Here is my .pro file:

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = InkPuppet
TEMPLATE = app


SOURCES += main.cpp\
        inkpuppet.cpp \
    aboutdialog.cpp \
    inkspot.cpp \
    newdialog.cpp

HEADERS  += inkpuppet.h \
    aboutdialog.h \
    inkspot.h \
    newdialog.h

FORMS    += inkpuppet.ui \
    aboutdialog.ui \
    newdialog.ui

OTHER_FILES += \
    InkPuppet.pro.user

RESOURCES += \
    resources.qrc

Here is my default header. inkpuppet.h

#ifndef INKPUPPET_H
#define INKPUPPET_H

#include "inkspot.h"
#include "ui_inkpuppet.h"

#include <QMainWindow>
#include <QWidget>

namespace Ui {
class InkPuppet;
}

class InkPuppet : public QMainWindow
{
    Q_OBJECT

public:
    explicit InkPuppet(QWidget *parent = 0);
    ~InkPuppet();

    Ui::InkPuppet *ui;

private slots:
    void setMinimum(int value);
    void setMaximum(int value);
    void actionNew();
    void actionAbout();
    void testButton();
};

#endif // INKPUPPET_H

newdialog.h

#ifndef NEWDIALOG_H
#define NEWDIALOG_H

#include "inkspot.h"
#include "inkpuppet.h"
#include "ui_inkpuppet.h"

#include <QDialog>

namespace Ui {
class NewDialog;
}

class NewDialog : public QDialog
{
    Q_OBJECT

public:
    explicit NewDialog(QWidget *parent = 0);
    ~NewDialog();
    InkPuppet *pointerToPuppet;

private:
    Ui::NewDialog *ui;

private slots:
    void createNew();

};

#endif // NEWDIALOG_H
4

1 回答 1

0
  1. 替换“InkPuppet *pointerToPuppet;” 使用“Ui::InkPuppet *pointerToPuppet;” 将解决您的编译问题。
  2. 重新安装您的 SDK 可能会解决自动完成问题。Qt 创建者自动完成代码的问题
于 2013-08-28T12:31:15.113 回答