Hello, I am using QtCreator as a compiler for C++ and I have the following problem:
Firstly, I made a Qt console application as a sample for something that I would like to include to my main application.
The sample's project file looks like:
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
CONFIG += link_pkgconfig
PKGCONFIG += libnotify
SOURCES += update-notifications.cpp
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
CONFIG += link_pkgconfig
PKGCONFIG += libnotify
SOURCES += update-notifications.cpp
To copy to clipboard, switch view to plain text mode
The 5th and 6th line are the important ones. This part actually links to the libnotify libraries.
So, my original code in the update-notifications.cpp file starts with:
#include <libnotify/notify.h>
..code
..more code etc.
#include <libnotify/notify.h>
..code
..more code etc.
To copy to clipboard, switch view to plain text mode
So, I simply link to the libnotify libraries and I use the library I need to use.
This sample runs very well!
The problem is that when I do these steps to my GUI main program, which was the initial purpose of making this sample, I get too many errors!
I mean, I link the libraries by editing the project file, I include the libnotify/notify.h library and even if I don't include any of the code I get errors like:
/usr/include/glib-2.0/gio/gdbusintrospection.h:151: error: expected unqualified-id before ‘protected’
/usr/include/glib-2.0/gio/gdbusintrospection.h:151: error: expected unqualified-id before ‘protected’
To copy to clipboard, switch view to plain text mode
So, as you see, the error isn't about my code?
? What....?
How weird can this be? The compiler finds errors at the libraries of libnotify while the sample code runs OK?
I tried recompiling the program via terminal in case qtcreator didn't remake the Makefile and didn't include the linked libraries but I get the same errors from there too.
It is the first time I get an error like this so I really need your help here....
So, in short words the problem is:
I make a sample and runs OK by linking the libraries and running the code.
In my main program I do exactly the same thing but the compiler finds errors about the libraries
The .pro files of both of the projects (because there is the key I think) are:
Sample project file:
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
CONFIG += link_pkgconfig
PKGCONFIG += libnotify
SOURCES += update-notifications.cpp
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
CONFIG += link_pkgconfig
PKGCONFIG += libnotify
SOURCES += update-notifications.cpp
To copy to clipboard, switch view to plain text mode
Main Project file:
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
QT += dbus
LIBS += -lcv -lhighgui
CONFIG += link_pkgconfig
PKGCONFIG += libnotify
# Input
HEADERS += about.h \
extras.h \
glob.h \
history.h \
mainwindow.h \
MyCameraWindow.h \
preferences.h \
properties.h \
QOpenCVWidget.h \
screenshot.h \
statistics.h
FORMS += about.ui \
extras.ui \
history.ui \
mainwindow.ui \
preferences.ui \
properties.ui \
screenshot.ui \
statistics.ui
SOURCES += about.cpp \
extras.cpp \
history.cpp \
main.cpp \
mainwindow.cpp \
MyCameraWindow.cpp \
preferences.cpp \
properties.cpp \
QOpenCVWidget.cpp \
screenshot.cpp \
statistics.cpp
RESOURCES += icons.qrc
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
QT += dbus
LIBS += -lcv -lhighgui
CONFIG += link_pkgconfig
PKGCONFIG += libnotify
# Input
HEADERS += about.h \
extras.h \
glob.h \
history.h \
mainwindow.h \
MyCameraWindow.h \
preferences.h \
properties.h \
QOpenCVWidget.h \
screenshot.h \
statistics.h
FORMS += about.ui \
extras.ui \
history.ui \
mainwindow.ui \
preferences.ui \
properties.ui \
screenshot.ui \
statistics.ui
SOURCES += about.cpp \
extras.cpp \
history.cpp \
main.cpp \
mainwindow.cpp \
MyCameraWindow.cpp \
preferences.cpp \
properties.cpp \
QOpenCVWidget.cpp \
screenshot.cpp \
statistics.cpp
RESOURCES += icons.qrc
To copy to clipboard, switch view to plain text mode
Thanks in advance for any answers...
Bookmarks