Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to use QJson in Qt creator (Qt 4.8.6)

How to use QJson in Qt creator (Qt 4.8.6)

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 4.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    HYSuperman
    wrote on last edited by
    #1

    I want to use QJson in Qt creator, I'm using Qt 4.8.6 so there is no Json lib in the QtCore like in Qt5.
    I have been to the "official sourceforge site":http://qjson.sourceforge.net/build/ and it says that I should install qjson using package manage tools. So I installed libqjson0, libqjson-dev, libqjson-dbg and libqjson0-dbg package using apt-get install.
    Than I created a new project and copy the official site's example to it. I alse modified my .pro file, I added an external library (libqjson.so) so Qt creator automatically added the following code to the .pro file:
    @win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../usr/lib/x86_64-linux-gnu/release/ -lqjson
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../usr/lib/x86_64-linux-gnu/debug/ -lqjson
    else:unix: LIBS += -L$$PWD/../../../../../../usr/lib/x86_64-linux-gnu/ -lqjson
    INCLUDEPATH += $$PWD/../../../../../../usr/lib/x86_64-linux-gnu
    DEPENDPATH += $$PWD/../../../../../../usr/lib/x86_64-linux-gnu
    @
    The libqjson.so file is in the x86_64-linux-gnu path.
    I also added a line including the parse.h file and other files with it:
    @INCLUDEPATH += $$PWD/../../../../../../usr/include/qjson@

    After that, I can include <parser.h>, but I can't use the function like toMap(), toString() in my code...

    I think there must be something wrong in my install procedure.
    Does anyone has an experience about installing QJson? Help Please!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Indeed, Qt 4.X doesn't have support for json.

      I would say that INCLUDEPATH doesn't contain the correct path to QJson's headers, correct it and you should be good to go

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved