You are not logged in.

1

Tuesday, September 27th 2011, 2:51pm

Json has not been declared.

Hello everyone,
I am trying to use json parser for parsing the data. i followed the above link.

http://qjson.sourceforge.net/usage.html

i used like this to parse the example text..

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
  p, li { white-space: pre-wrap; }       bool ok;
     QVariantMap result = Json::parse(QString(txt), ok).toMap();
     if (!ok) {
     qFatal("An error occurred during parsing");
     exit (1);
     }
     QVariantMap responseMap = result["response"].toMap();
     QVariantMap statusMap = result["response"].toMap();
 
     qDebug() << "success:" << statusMap["success"].toString();
     qDebug() << "name:" << statusMap["name"].toString();
     qDebug() << "first_name:" << statusMap["first_name"].toString();
     qDebug() << "last_name:" << statusMap["last_name"].toString();
     qDebug() << "clingle_userid:" << statusMap["clingle_userid"].toString();


but i am gettin json has not been declared... wat mite be the prob i tried adding headers but i dnt find any corresponding header files. wat should i do???? thanks for any replies.....

bolt18_80

Intermediate

  • "bolt18_80" is male

Posts: 186

Location: Ohio, US

Occupation: Programmer/Analyst

  • Send private message

2

Tuesday, September 27th 2011, 3:11pm

In the project file (.pro) for your project, you can specify additional directories in the files system to search for header files using the following...

Source code

1
2
INCLUDEPATH += ../my/relative/path
INCLUDEPATH += D:/my/absolute/path


After making the change make sure you re-run qmake to rebuild the Makefile for your project.
Note the usage of all forward slashes. I think the use of backslashes has been deprecated even on the Windows platform.

Good luck!
--
Chris
Christopher Springer
Programmer/Analyst
NBEC/NWOCA - Ohio SSDT
Website: http://www.moderncpp.org
cspringer@moderncpp.org

3

Wednesday, September 28th 2011, 5:37am

In the project file (.pro) for your project, you can specify additional directories in the files system to search for header files using the following...

Source code

1
2
INCLUDEPATH += ../my/relative/path
INCLUDEPATH += D:/my/absolute/path


After making the change make sure you re-run qmake to rebuild the Makefile for your project.
Note the usage of all forward slashes. I think the use of backslashes has been deprecated even on the Windows platform.

Good luck!
--
Chris

Hi bolt thanks for your reply.. i did as u said i included the following 2 lines in .pro file

Source code

1
2
INCLUDEPATH += ../my/relative/path
INCLUDEPATH += D:/my/absolute/path


and re ran the qmake but the problem remains the same. wat can i do now ? thanks for any replies.

4

Wednesday, September 28th 2011, 6:26am

Hi bolt i included as u said...

INCLUDEPATH += ../my/relative/path
INCLUDEPATH += D:/my/absolute/path

my prob remains i think this path is used by you. but in this path wat should i map it??? which path should i use it for json ????

This post has been edited 2 times, last edit by "smartworker" (Sep 28th 2011, 12:28pm)


5

Wednesday, September 28th 2011, 12:31pm

I searched in forum and also in google but i dn't get any solution for this problem. as i am new to Qt can anyone help me to solve this problem.. how should i add qjson to my application??? i am using the following link

http://qjson.sourceforge.net/usage.html any replies ill be really helpful.

pitonyak

Trainee

  • "pitonyak" is male

Posts: 57

Location: Columbus, Ohio, USA

  • Send private message

6

Wednesday, September 28th 2011, 5:58pm

Step 1: Find the required include files for the JSON stuff. If you cannot find where they are, then you cannot proceed.

Step 2: use the path you found in Step 1 and add that with the INCLUDEPATH.

7

Thursday, September 29th 2011, 5:46am

Step 1: Find the required include files for the JSON stuff. If you cannot find where they are, then you cannot proceed.

Step 2: use the path you found in Step 1 and add that with the INCLUDEPATH.

Hello Pitonyak,
Thanks for ur reply but i dnt find any include files related to Qjson in my installed path of Qt creator... is that correct where i am looking for ??? r i should find in some other location ???

i downloaded the json project file from the below link
http://sourceforge.net/projects/qjson/files/qjson/

i tried to build it for extracting the lib but for that i dnt find the .pro file in that folder... how to build this qjson project so that i can link the lib from it..

Thanks for any replies..

This post has been edited 1 times, last edit by "smartworker" (Sep 29th 2011, 7:32am)


8

Thursday, September 29th 2011, 12:36pm

Is there any one used the Qjson parser for Qt???? if so can u please attach the library files used for the Qjon parser. i tried to build the qjson source but i couldn't successfully built the .lib files.

any persons worked with this or seniors response ill be really helpful... as i am new to this environment everything is strange so please come forward to help the beginners. thanks