我将一个应用程序移植到我在linux上开发的Windows上构建项目时出现以下错误:
error: C2470: 'final' : looks like a function definition, but there is no parameter list; skipping apparent body
这是我的main.cpp
#include "mainwindow.h"
#include <QApplication>
#include <ctime>
#include <iostream>
#include <QPixmap>
#include <stdio.h>
#include <QProcess>
#include <QString>
#include <tango.h>
#include <QPainter>
#include <QPen>
#include <QBrush>
#include <QLabel>
#include <QTimer>
#include <ctime>
#include <QMessageBox>
class Application final : public QApplication {
Application(int& argc, char** argv) : QApplication(argc, argv) {}
virtual bool notify(QObject *receiver, QEvent *e) override {
// your code here
try
{
return QApplication::notify( receiver, e );
}
catch(Tango::DevFailed e)
{
//QMessageBox::information(this,tr("Update Failed"),tr("Error updating values.Try again."));
}
catch(Tango::CommunicationFailed e)
{
//QMessageBox::information(this,tr("Communication with device failed"),tr("Error updating values.Try again."));
}
}
};
int main(int argc, char *argv[]) try
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
catch (Tango::DevFailed e)
{
//QMessageBox::information(this,tr("Updating values failed"),tr("Error updating values.Try again."));
}
catch (Tango::CommunicationFailed e)
{
//QMessageBox::information(this,tr("Communication Failed"),tr("Error updating values.Try again."));
}
这是我的.pro文件:
#-------------------------------------------------
#
# Project created by QtCreator 2014-12-08T09:19:31
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = FirstProject
TEMPLATE = app
QMAKE_CXXFLAGS += -std=c++11
SOURCES += main.cpp\
firstscreen.cpp \
secondscreen.cpp \
thirdscreen.cpp
INCLUDEPATH += C:\Users\user_name\tango\ \
C:\Users\user_name\omniORB4\ \
C:\Users\user_name\omnithread.h
HEADERS += firstscreen.h \
C:\Users\user_name\tango\ \
C:\Users\user_name\omniORB4\ \
C:\Users\user_name\omnithread.h \
secondscreen.h \
thirdscreen.h
LIBS += -L -lomnithread \
-L -lomniORB4 \
-L -ltango
FORMS += firstscreen.ui \
secondscreen.ui \
thirdscreen.ui
你可以告诉我这里缺少的东西吗?我认为错误与c ++标准有关,但我不确定如何解决它。