Namespace enclosing 'MainWindow' [-fpermissive]
-
mainwindow.h
@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H#include <QMainWindow>
#include <QtCore>
#include <QtGui>
#include <QtWidgets>
#include <QGraphicsOpacityEffect>
#include <QtSql>
#include <QPrinter>
#include "dark.h"namespace Ui {
class MainWindow;
}class MainWindow : public QMainWindow
{
Q_OBJECTprotected:
void closeEvent(QCloseEvent *event);
public:
explicit MainWindow(QWidget *parent = 0); ~MainWindow();
public slots:
private:
Ui::MainWindow *ui;
private slots:
void animeTDB();
};
#endif // MAINWINDOW_H
@mainwindow.cpp
@
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);}
@error
definition of 'MainWindow::MainWindow(QWidget*)' is not in namespace enclosing 'MainWindow' [-fpermissive]
MainWindow::MainWindow(QWidget *parent) :
^[edit: added missing coding tags @ SGaist]
-
Oh yes, sorry im forgot it, if you want the full project just tell me to send you in your mail because it very long, the same error for all functions in mainwindow.cpp. thanks. sorry for my english
mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
...
...
.
} -
Could you remove #include "dark.h" from mainwindow.h, comment out all the code using anything from dark.h and recompile your project.
I think there is a namespace somewhere accesible via dark.h which is not closed properly so that the compiler thinks that that MainWindow class definition in mainwindow.h is in that namespace. But since the definition of MainWindow's methods in mainwindows.cpp are not in that namespace you get this error.
By the way I don't know anything about the -fpermissive flag.
-
Not match, the same error
download and compile my project at this link "click here":https://1fichier.com/?blujqp859m please help me.
-
Just what I expected: the PME namespace in pme.h is missing the closing brace. Add a '}' at the bottom of the pme.h before the #endif and you will start getting your more regular compile errors.
Disabling dark.h in mainwindows.h couldn't have worked since there are more than 15 non-Qt headers in mainwindows.cpp. pme.h was not seen via dark.h but directly #include'd in the cpp file.