PDA

View Full Version : Program won't compile since update from Qt5.4 to Qt5.5 | Error in Qt files?



derplord123
2nd October 2015, 20:31
This is my old system where my program compiles just fine:

qt5-base 5.4.1-2
qt5-declarative 5.4.1-2
qt5-doc 5.4.1-2
qt5-graphicaleffects 5.5.0-2
qt5-location 5.4.1-2
qt5-quick1 5.4.1-2
qt5-quickcontrols 5.4.1-2
qt5-script 5.4.1-2
qt5-sensors 5.4.1-2
qt5-svg 5.4.1-2
qt5-tools 5.4.1-2
qt5-translations 5.4.1-2
qt5-webchannel 5.4.1-2
qt5-webkit 5.4.1-2
qt5-xmlpatterns 5.4.1-2
qtchooser 48-1
qtcreator 3.3.2-1

After the update:

qt5-base 5.5.0-2
qt5-declarative 5.5.0-2
qt5-doc 5.5.0-2
qt5-graphicaleffects 5.5.0-2
qt5-location 5.5.0-2
qt5-quick1 5.5.0-2
qt5-quickcontrols 5.5.0-2
qt5-script 5.5.0-2
qt5-sensors 5.5.0-2
qt5-svg 5.5.0-2
qt5-tools 5.5.0-2
qt5-translations 5.5.0-2
qt5-webchannel 5.5.0-2
qt5-webkit 5.5.0-2
qt5-xmlpatterns 5.5.0-2
qtchooser 48-1
qtcreator 3.5.0-1

This is the error I get:

17:23:23: Running steps for project graphit...
17:23:23: Configuration unchanged, skipping qmake step.
17:23:23: Starting: "/usr/bin/make"
g++ -c -pipe -std=c++11 -O2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -std=c++0x -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -Iinclude -Iinclude/knowdesk -Ilibs -Ilibs -Ipodofo/include -Iexif/include -Iexif/include -isystem /usr/include/qt -isystem /usr/include/qt/QtQuick -isystem /usr/include/qt/QtWidgets -isystem /usr/include/qt/QtGui -isystem /usr/include/qt/QtQml -isystem /usr/include/qt/QtNetwork -isystem /usr/include/qt/QtCore -Ibuild -I/usr/lib/qt/mkspecs/linux-g++ -o build/controller.o src/controller.cpp
In file included from /usr/include/qt/QtCore/qglobal.h:74:0,
from /usr/include/qt/QtCore/qnamespace.h:37,
from /usr/include/qt/QtCore/qobjectdefs.h:41,
from /usr/include/qt/QtCore/qobject.h:40,
from /usr/include/qt/QtCore/QObject:1,
from src/controller.cpp:2:
/usr/include/qt/QtCore/qurl.h:365:1: error: initializer provided for function
Q_DECLARE_SHARED(QUrl)
^
Makefile:975: recipe for target 'build/controller.o' failed
make: *** [build/controller.o] Error 1
17:23:26: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project graphit (kit: Desktop)
When executing step "Make"
17:23:26: Elapsed time: 00:03.

It seems like it fails compiling as soon as I include anything Q* in a .cpp file. Even if I remove the statements from src/controller.cpp, a similar error gets thrown in the next file where I include Q*. In it's always "initializer provided for function". A new project compiles fine and I can't pinpoint anything that causes the error in my project. Does anyone have an idea what causes the problem? I'm pretty desperate at this point, any help will be appreciated. I can also upload the source files if the error is too ambiguous.

ChrisW67
3rd October 2015, 04:27
What are the first 5-10 lines of src/controller.cpp? If line 1 is an include of controller.h or something else from your sources then that file would be useful to see.

What version of GCC?
Are you doing a clean rebuild without any pre-compiled header lying about?

derplord123
4th October 2015, 02:32
controller.cpp


#include "controller.h"
#include <QObject>
#include <QString>
#include <QVariant>
#include <QVariantList>
#include <QVariantMap>
#include <string>
#include <vector>
#include "controller.h"
#include "itemcontroller.h"
#include "modelcontroller.h"
#include "knowdesk/knowledgeDB.h"
#include "templatecontroller.h"
#include "filecontroller.h"
#include "libs/easylogging++.h"


void Controller::setQuery(QueryController* q) {
query = q;
}

QueryController* Controller::getQuery() {
return query;
}
.
.
.


controller.h


#ifndef CONTROLLER_H
#define CONTROLLER_H

class QueryController;
class FileController;
class ModelController;
class TemplateController;
class ItemController;
class KnowledgeDB;

class Controller {
public:
void setQuery(QueryController*);
QueryController* getQuery();

void setFile(FileController*);
FileController* getFile();

void setModel(ModelController*);
ModelController* getModel();

void setTemplate(TemplateController*);
TemplateController* getTemplate();

void setItem(ItemController*);
ItemController* getItem();

void setDB(KnowledgeDB*);
KnowledgeDB* getDB();
private:
QueryController* query;
FileController* file;
ModelController* model;
TemplateController* template_;
ItemController* item;
KnowledgeDB* db;
};

#endif // CONTROLLER_H


I don't actually use any of the Q* in controller.cpp. If I remove the #include <Q*> statements, this error will be thrown in the next Header File that attempts to include Q*, itemcontroller.h:


02:25:07: Running steps for project graphit...
02:25:07: Configuration unchanged, skipping qmake step.
02:25:07: Starting: "/usr/bin/make"
g++ -c -pipe -std=c++11 -O2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -std=c++0x -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -Iinclude -Iinclude/knowdesk -Ilibs -Ilibs -Ipodofo/include -Iexif/include -Iexif/include -isystem /usr/include/qt -isystem /usr/include/qt/QtQuick -isystem /usr/include/qt/QtWidgets -isystem /usr/include/qt/QtGui -isystem /usr/include/qt/QtQml -isystem /usr/include/qt/QtNetwork -isystem /usr/include/qt/QtCore -Ibuild -I/usr/lib/qt/mkspecs/linux-g++ -o build/controller.o src/controller.cpp
In file included from /usr/include/qt/QtCore/qglobal.h:74:0,
from /usr/include/qt/QtCore/qnamespace.h:37,
from /usr/include/qt/QtCore/qobjectdefs.h:41,
from /usr/include/qt/QtCore/qobject.h:40,
from /usr/include/qt/QtCore/QObject:1,
from include/itemcontroller.h:4,
from src/controller.cpp:6:
/usr/include/qt/QtCore/qurl.h:365:1: error: initializer provided for function
Q_DECLARE_SHARED(QUrl)
^
Makefile:975: recipe for target 'build/controller.o' failed
make: *** [build/controller.o] Error 1
02:25:09: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project graphit (kit: Desktop)
When executing step "Make"
02:25:09: Elapsed time: 00:03.


I have gcc version 5.2.0 and the same error appears after I delete all build files, rerun qmake and rebuild.

I went back in my repo and found that the point where this compilation error first appears is when I change


QApplication app(argc, argv);
QQmlEngine engine;

to


QtQuickControlsApplication app(argc, argv);
QQmlApplicationEngine engine;

But even after changing this in back in the main.cpp file, or even commenting everything there out, it fails much at other files. So I'm not sure if this relates.

derplord123
6th October 2015, 11:56
Here are the source files: http://ge.tt/13W34MP2/v/0
You need SQLite and QtCreator as I haven't configured it for static build yet.
I can offer to 0.08BTC (around 17€) for anyone who can help me.