0

I have written a very simple C++/Qt application using QGIS comprised of a single "main.cpp" file as below:

#include <qgsapplication.h>

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

and my Qt Creator project file is defined as:

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = qgis_test
TEMPLATE = app

CONFIG += c++11

SOURCES += main.cpp

HEADERS  +=

LIBS += -L/usr/local/lib -lqgis_core

QGIS_DIR = /home/rouhollah/Programs/qgis-2.8.1

INCLUDEPATH += $$QGIS_DIR
INCLUDEPATH += $$QGIS_DIR/src/core

DEFINES += CORE_EXPORT= GUI_EXPORT=

The program is compiled and linked, but exits unexpectedly when run with the following error message:

realloc(): invalid pointer: 0x00007fc3d802e0e0

Even running the program in the Debug mode, the debugger stops before hitting the breakpoint at the first line of the main function.

Note that I have installed the QGIS libraries by compiling the source codes obtained from GitHub.

1

After hours of trying out whatever I could think of, I finally found out that QGIS is not compatible with Qt 5.4. Hence, I managed to run a sample program compiled and linked against Qt 4.8.6.

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.