I am using QtCreator and QGIS 2.6 to build a standalone C++ application.
The problem I am encountering is the project cannot find all the necessary header files.
My .pro file looks lie the following:
QT += core gui xml
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = TestQgis2
TEMPLATE = app
SOURCES += main.cpp
#HEADERS +=YOUR HEADERS
#FORMS += YOUR FORMS
#RESOURCES += images/images.qrc
win32:CONFIG(Release, Debug|Release) {
LIBS += -L"C:/Program Files (x86)/QGIS Brighton/lib/" -lQtCore4
LIBS += -L"C:/Program Files (x86)/QGIS Brighton/lib/" -lQtGui4
LIBS += -L"C:/Program Files (x86)/QGIS Brighton/lib/" -lQtXml4
LIBS += -L"C:/Program Files (x86)/QGIS Brighton/apps/qgis/bin/" -lqgis_core
LIBS += -L"C:/Program Files (x86)/QGIS Brighton/apps/qgis/bin/" -lqgis_gui
}
else:win32:CONFIG(Debug, Debug|Release) {
PRE_TARGETDEPS += C:/Program Files (x86)/QGIS Brighton/lib/QtCored4.lib
PRE_TARGETDEPS += C:/Program Files (x86)/QGIS Brighton/lib/QtGuid4.lib
PRE_TARGETDEPS += C:/Program Files (x86)/QGIS Brighton/lib/QtXmld4.lib
LIBS += -L"C:/Program Files (x86)/QGIS Brighton/lib/" -lQtCored4
LIBS += -L"C:/Program Files (x86)/QGIS Brighton/lib/" -lQtGuid4
LIBS += -L"C:/Program Files (x86)/QGIS Brighton/lib/" -lQtXmld4
LIBS += -L"C:/Program Files (x86)/QGIS Brighton/apps/qgis/bin/" -lqgis_core
LIBS += -L"C:/Program Files (x86)/QGIS Brighton/apps/qgis/bin/" -lqgis_gui
}
win32:{
INCLUDEPATH += C:/Program Files (x86)/QGIS Brighton/include
DEPENDPATH += C:/Program Files (x86)/QGIS Brighton/include
# INCLUDEPATH += C:/OSGeo4W/apps/qgis-dev/include
# DEPENDPATH += C:/OSGeo4W/apps/qgis-dev/include
DEFINES += GUI_EXPORT=__declspec(dllimport) CORE_EXPORT=__declspec(dllimport)
}
unix {
LIBS += -L/usr/local/lib/ -lqgis_core -lqgis_gui
LIBS += -L/usr/local/lib/qgis/plugins/ -lgdalprovider
INCLUDEPATH += /usr/local/include/qgis
DEFINES += GUI_EXPORT= CORE_EXPORT=
}
And in my program, none of the following headers can be found:
#include "<"qgsapplication.h">"
#include "<"qgsproviderregistry.h">"
#include "<"qgssinglesymbolrenderer.h">"
#include "<"qgsmaplayerregistry.h">"
#include "<"qgsvectorlayer.h">"
#include "<"qgsmapcanvas.h">"
And from the installed qgis folder, I cannot find any of the above header files.
Any help is appreciated.
To debug your application I think you must add RelWithDebInfo mode in your project file: