2

I am a Qt/C++ developer. I have to create a GUI application (Qt/C++) with GIS maps. I'm trying to do that using QGIS.

I'm working in Linux Ubuntu with Qt Creator 2.4.1 (based on Qt 4.8.0).

I did the following steps:

  • I installed QGIS packages (QGis starts correctly)
  • Then I downloaded QGIS source files.

Now I'm trying to create a simple Hello World QGIS application, but something doesn't work.

My programs has just one main.cpp file. The code is:

#include "qgsapplication.h"

int main(int argc, char ** argv)
{
   QgsApplication app(argc, argv, true);
   return 0;
}

The .pro file is:

#-------------------------------------------------
#
# Project created by QtCreator 2015-05-15T09:58:00
#
#-------------------------------------------------

QT       += core gui

TARGET = TestQGIS
TEMPLATE = app

INCLUDEPATH += /home/pesce/qgis-2.8.1/src/core/


SOURCES += main.cpp

HEADERS  +=

I'm trying to compile but the following error is shown:

/home/pesce/GUI/TestQGIS/../../qgis-2.8.1/src/core/qgsapplication.h:23: error: qgsconfig.h: No such file or directory

It seems that qgsconfig.h is missing......

Which is the problem? How can I fix this problem?


There was a libraries problem..not all the needed libraries were included! I've included all the libraries and now all the needed files are correctly present.

But I'm not still able to compile the code.... the following error is shown: /usr/include/qgis/qgsapplication.h:55: error: 'override' does not name a type

It seems a problem of the compiler..

Any suggestion?

  • This may seem like a silly question but did you install libqgis-dev? – Stev_k May 16 '15 at 12:15
  • Uhm... yes.. I think... :) I downloaded and installed QGis from the repository... QGis corretly works. Maybe something is missing in my .pro file. Maybe the library is installed, but not included to the project... where can I find libqgis-dev? I'm working on ubuntu... thanks – AlePe May 18 '15 at 7:54
  • UPDATE!!!! There was a libraries problem..not all the needed libraries were included! I've included all the libraries and now all the needed files are correctly present. But I'm not still able to compile the code.... the following error is shown: /usr/include/qgis/qgsapplication.h:55: error: 'override' does not name a type It seems a problem of the compiler.. Any suggestion? thanks a lot! – AlePe May 19 '15 at 10:47
1

Override specifier added in C++11, so you need last g++ compiler version. Try to find qgsconfig.h on your computer and copy to /home/pesce/qgis-2.8.1/src/core/. I also recommnded you install qgis using OSGeo4W installer.

  • SOLVED!!!! Thanks, I fixed all bugs! Thanks you for all the suggestion! How I fixed: - qgsconfig.h wasn't found because I made a mistake when I included the libraries (some libraries were missing). - I fixed the "override" problem using last g++ compiler.. thanks Egor! (If you can't use the last g++ compiler, you can "workaround" the problem just deleting "override" keyword from the code...it works!) – AlePe May 19 '15 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.