JSON-C compilation issue with qt



  • I'm porting a C project into QT C++ and I've already installed libjsonc-dev and libjson0 libjson0-dev on my Ubuntu box, but I got many compilation error indicating QT compiler is not understanding json-c data types,
    Sample Errors:
    Undefined reference to json_object_array_length
    Undefined reference to json_object_array_get_idx
    Any experience in using json-c inside QT ?



  • HI and welcome to devnet,

    why do you need json-c?? Qt has native JSON support



  • As I said I am importing a already implemented C code into QT and I prefer to not changing much code,
    Any help making JSON-C works on QT is highly appreciated.


  • Qt Champions 2016

    @hgoles said:

    Undefined reference to json_object_array_length

    sounds like a linker error. Have you included your library to be linked in your qt project?
    Something like this (in your .pro file):

    LIBS += -ljsonc
    


  • @kshegunov said:

    LIBS += -ljsonc

    I got it fixed by LIBS += -ljson-c
    Thank you so much


  • Qt Champions 2016

    You're welcome.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.