Results 1 to 2 of 2

Thread: QtCreator weird error while trying to use libnotify libs

  1. #1
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Exclamation QtCreator weird error while trying to use libnotify libs

    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:
    Qt Code:
    1. TEMPLATE = app
    2. TARGET =
    3. DEPENDPATH += .
    4. INCLUDEPATH += .
    5. CONFIG += link_pkgconfig
    6. PKGCONFIG += libnotify
    7. 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:
    Qt Code:
    1. #include <libnotify/notify.h>
    2. ..code
    3. ..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:
    Qt Code:
    1. /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:
    Qt Code:
    1. TEMPLATE = app
    2. TARGET =
    3. DEPENDPATH += .
    4. INCLUDEPATH += .
    5. CONFIG += link_pkgconfig
    6. PKGCONFIG += libnotify
    7. SOURCES += update-notifications.cpp
    To copy to clipboard, switch view to plain text mode 

    Main Project file:
    Qt Code:
    1. TEMPLATE = app
    2. TARGET =
    3. DEPENDPATH += .
    4. INCLUDEPATH += .
    5. QT += dbus
    6. LIBS += -lcv -lhighgui
    7. CONFIG += link_pkgconfig
    8. PKGCONFIG += libnotify
    9.  
    10. # Input
    11. HEADERS += about.h \
    12. extras.h \
    13. glob.h \
    14. history.h \
    15. mainwindow.h \
    16. MyCameraWindow.h \
    17. preferences.h \
    18. properties.h \
    19. QOpenCVWidget.h \
    20. screenshot.h \
    21. statistics.h
    22. FORMS += about.ui \
    23. extras.ui \
    24. history.ui \
    25. mainwindow.ui \
    26. preferences.ui \
    27. properties.ui \
    28. screenshot.ui \
    29. statistics.ui
    30. SOURCES += about.cpp \
    31. extras.cpp \
    32. history.cpp \
    33. main.cpp \
    34. mainwindow.cpp \
    35. MyCameraWindow.cpp \
    36. preferences.cpp \
    37. properties.cpp \
    38. QOpenCVWidget.cpp \
    39. screenshot.cpp \
    40. statistics.cpp
    41. RESOURCES += icons.qrc
    To copy to clipboard, switch view to plain text mode 
    Thanks in advance for any answers...
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

  2. #2
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QtCreator weird error while trying to use libnotify libs

    Ok, I found a solution! The library I included used the word 'signals' to name something, but this is not permitted because this word is used by Qt. The solution is to type:
    Qt Code:
    1. #define QT_NO_KEYWORDS
    To copy to clipboard, switch view to plain text mode 
    before including anything in the file you have the inclusion of the file...
    Then replace the following:
    Qt Code:
    1. SLOT() -> Q_SLOT()
    2. slots: -> Q_SLOTS:
    3. SIGNAL() -> Q_SIGNAL()
    4. signals: -> Q_SIGNALS:
    5. emit -> Q_EMIT
    To copy to clipboard, switch view to plain text mode 
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

Similar Threads

  1. How to use libnotify?
    By Bong.Da.City in forum Qt Programming
    Replies: 1
    Last Post: 26th August 2010, 05:53
  2. Replies: 7
    Last Post: 4th June 2010, 14:52
  3. Replies: 2
    Last Post: 24th May 2009, 17:05
  4. Weird compile error
    By MarkoSan in forum Qt Programming
    Replies: 6
    Last Post: 3rd December 2007, 18:50
  5. weird error
    By mickey in forum General Programming
    Replies: 6
    Last Post: 18th November 2006, 04:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.