Я видел много других сообщений об этой ошибке, но ни один метод исправления не помог. Я новичок в создании Qt, поэтому, вероятно, я здесь что-то упускаю, но я создал проект виджета. Вот файлы:
main.cpp
Код: Выделить всё
#include "mainwindow.h"
#include
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
Код: Выделить всё
#include "mainwindow.h"
#include
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
setFixedSize(500,500);
QPushButton myButton;
myButton.setText("Hello world, this is a GUI app!!!");
}
MainWindow::~MainWindow()
{
}
Код: Выделить всё
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
};
#endif // MAINWINDOW_H
Код: Выделить всё
#-------------------------------------------------
#
# Project created by QtCreator 2018-03-11T19:52:19
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = myWindow
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
QT += sql #added because I found this to try and solve my problem, doesn't fix
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
Подробнее здесь: https://stackoverflow.com/questions/492 ... nce-to-imp
Мобильная версия