c++ - How to install QJson in Qt creator (Qt 4.8.6) -



c++ - How to install QJson in Qt creator (Qt 4.8.6) -

i want utilize qjson in qt creator. i'm using qt 4.8.6 there no json lib in qtcore in qt5.

i have been sourceforge site: http://qjson.sourceforge.net/build/ , says should install qjson using bundle manage tools. installed libqjson0, libqjson-dev, libqjson-dbg , libqjson0-dbg bundle using apt-get install.

than created new project , re-create official site's illustration it. alse modified .pro file, added external library (libqjson.so) qt creator automatically added next code .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 in x86_64-linux-gnu path. added line including parse.h file , other files it: includepath += $$pwd/../../../../../../usr/include/qjson

after that, can include , can't utilize function tomap(), tostring() in code...

i think there must wrong in install procedure. here code:

int main(int argc, char *argv[]) { qjson::parser parser; bool ok; qstring json; json = "{\"encoding\" : \"utf-8\",\"plug-ins\": [\"python\",\"c++\", \"ruby\"],\"indent\":{\"length\": 3,\"use_space\":true}}"; qvariantmap result = parser.parse(json, &ok).tomap(); if (!ok) { qfatal("an error occurred during parsing"); exit (1); } qdebug() << "encoding:" << result["encoding"].tostring(); qdebug() << "plugins:"; foreach (qvariant plugin, result["plug-ins"].tolist()) { qdebug() << "\t-" << plugin.tostring(); } qvariantmap nestedmap = result["indent"].tomap(); qdebug() << "length:" << nestedmap["length"].toint(); qdebug() << "use_space:" << nestedmap["use_space"].tobool(); qapplication a(argc, argv); qjsons w; w.show(); homecoming a.exec(); }

and error information:

08:40:53: running steps project qjson... 08:40:53: configuration unchanged, skipping qmake step. 08:40:53: starting: "/usr/bin/make" /usr/local/trolltech/qt-4.8.6/bin/qmake -spec /usr/local/trolltech/qt-4.8.6/mkspecs/linux-g++ config+=debug -o makefile ../qjson/qjson.pro g++ -c -pipe -g -wall -w -d_reentrant -dqt_gui_lib -dqt_core_lib -dqt_shared -i/usr/local/trolltech/qt-4.8.6/mkspecs/linux-g++ -i../qjson -i/usr/local/trolltech/qt-4.8.6/include/qtcore -i/usr/local/trolltech/qt-4.8.6/include/qtgui -i/usr/local/trolltech/qt-4.8.6/include -i/home/cecaadmin/grt/qtprojects/tranferfiledemo/qjson/../../../usr/include/qjson -i/usr/include/qjson -i. -i../qjson -i. -o main.o ../qjson/main.cpp

../qjson/main.cpp: in function 'int main(int, char**)':

../qjson/main.cpp:13:48: error: no matching function phone call

'qjson::parser::parse(qstring&, bool*)' qvariantmap result = parser.parse(json, &ok).tomap(); ^ ../qjson/main.cpp:13:48: note: candidates are: in file included ../qjson/main.cpp:4:0: /usr/include/qjson/parser.h:51:16: note: qvariant qjson::parser::parse(qiodevice*, bool*) qvariant parse(qiodevice* io, bool* ok = 0); ^ /usr/include/qjson/parser.h:51:16: note: no known conversion argument 1 'qstring' 'qiodevice*' /usr/include/qjson/parser.h:61:16: note: qvariant qjson::parser::parse(const qbytearray&, bool*) qvariant parse(const qbytearray& jsondata, bool* ok = 0); ^ /usr/include/qjson/parser.h:61:16: note: no known conversion argument 1 'qstring' 'const qbytearray&' ../qjson/main.cpp:19:12: error: invalid utilize of incomplete type 'class qdebug' qdebug() << "encoding:" << result["encoding"].tostring(); ^ in file included /usr/local/trolltech/qt-4.8.6/include/qtcore/qnamespace.h:45:0, /usr/local/trolltech/qt-4.8.6/include/qtcore/qobjectdefs.h:45, /usr/local/trolltech/qt-4.8.6/include/qtgui/qwindowdefs.h:45, /usr/local/trolltech/qt-4.8.6/include/qtgui/qwidget.h:46, /usr/local/trolltech/qt-4.8.6/include/qtgui/qwidget:1, ../qjson/qjsons.h:4, ../qjson/main.cpp:1:

/usr/local/trolltech/qt-4.8.6/include/qtcore/qglobal.h:1793:7: error: forwards declaration of 'class qdebug' class qdebug; ^

../qjson/main.cpp:20:12: error: invalid utilize of incomplete type 'class qdebug' qdebug() << "plugins:"; ^ in file included /usr/local/trolltech/qt-4.8.6/include/qtcore/qnamespace.h:45:0, /usr/local/trolltech/qt-4.8.6/include/qtcore/qobjectdefs.h:45, /usr/local/trolltech/qt-4.8.6/include/qtgui/qwindowdefs.h:45, /usr/local/trolltech/qt-4.8.6/include/qtgui/qwidget.h:46, /usr/local/trolltech/qt-4.8.6/include/qtgui/qwidget:1, ../qjson/qjsons.h:4, ../qjson/main.cpp:1:

/usr/local/trolltech/qt-4.8.6/include/qtcore/qglobal.h:1793:7: error: forwards declaration of 'class qdebug' class qdebug; ^

../qjson/main.cpp:23:14: error: invalid utilize of incomplete type 'class qdebug' qdebug() << "\t-" << plugin.tostring(); ^ in file included /usr/local/trolltech/qt-4.8.6/include/qtcore/qnamespace.h:45:0, /usr/local/trolltech/qt-4.8.6/include/qtcore/qobjectdefs.h:45, /usr/local/trolltech/qt-4.8.6/include/qtgui/qwindowdefs.h:45, /usr/local/trolltech/qt-4.8.6/include/qtgui/qwidget.h:46, /usr/local/trolltech/qt-4.8.6/include/qtgui/qwidget:1, ../qjson/qjsons.h:4, ../qjson/main.cpp:1:

/usr/local/trolltech/qt-4.8.6/include/qtcore/qglobal.h:1793:7: error: forwards declaration of 'class qdebug' class qdebug; ^

../qjson/main.cpp:27:12: error: invalid utilize of incomplete type 'class qdebug' qdebug() << "length:" << nestedmap["length"].toint(); ^ in file included /usr/local/trolltech/qt-4.8.6/include/qtcore/qnamespace.h:45:0, /usr/local/trolltech/qt-4.8.6/include/qtcore/qobjectdefs.h:45, /usr/local/trolltech/qt-4.8.6/include/qtgui/qwindowdefs.h:45, /usr/local/trolltech/qt-4.8.6/include/qtgui/qwidget.h:46, /usr/local/trolltech/qt-4.8.6/include/qtgui/qwidget:1, ../qjson/qjsons.h:4, ../qjson/main.cpp:1:

/usr/local/trolltech/qt-4.8.6/include/qtcore/qglobal.h:1793:7: error: forwards declaration of 'class qdebug' class qdebug; ^

../qjson/main.cpp:28:12: error: invalid utilize of incomplete type 'class qdebug' qdebug() << "use_space:" << nestedmap["use_space"].tobool(); ^ in file included /usr/local/trolltech/qt-4.8.6/include/qtcore/qnamespace.h:45:0, /usr/local/trolltech/qt-4.8.6/include/qtcore/qobjectdefs.h:45, /usr/local/trolltech/qt-4.8.6/include/qtgui/qwindowdefs.h:45, /usr/local/trolltech/qt-4.8.6/include/qtgui/qwidget.h:46, /usr/local/trolltech/qt-4.8.6/include/qtgui/qwidget:1, ../qjson/qjsons.h:4, ../qjson/main.cpp:1:

/usr/local/trolltech/qt-4.8.6/include/qtcore/qglobal.h:1793:7: error: forwards declaration of 'class qdebug' class qdebug; ^ /usr/local/trolltech/qt-4.8.6/include/qtcore/qglobal.h: @ global scope: /usr/local/trolltech/qt-4.8.6/include/qtcore/qglobal.h:1796:29: warning: inline function 'qdebug qdebug()' used never defined [enabled default] q_core_export_inline qdebug qdebug(); ^ make: *** [main.o] error 1 08:40:54: process "/usr/bin/make" exited code 2. error while building/deploying project qjson (kit: desktop) when executing step 'make'

c++ json linux qt qt4

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -