Could someone please let me know the exact steps in getting jsoncpp library to work on visual studio 2008. I am pretty new to visual studio, so don't quite understand how to go about this and I want to use jsoncpp for an MFC application. I read the readme of jsoncpp, and installed python on my machine, but I am still quite unclear about the remaining steps. Any help would be greatly appreciated. Thanks.
2 Answers
I recently added CMake build for jsoncpp -- will support various flavor of visual studio.
- Install CMake
- Download sources with my update: https://github.com/okigan/jsoncpp
- And run bootstrap.bat file
Both Debug/Release will be built and stored in ./stage directory.

- 1,559
- 2
- 18
- 33
-
Does it support VS 2013 and Windows 8? – The Mask Jun 05 '14 at 16:32
-
CMake supports VS2013 (http://www.cmake.org/cmake/help/v2.8.11/cmake.html#gen:VisualStudio12) so should work. – okigan Jun 05 '14 at 20:06
The jsoncpp README file, unfortunately, does not list Visual Studio 2008 as a supported build.
However, jsoncpp on vc90? has an answer which points out that there is no need to use SCONs, because somebody already created and included a Visual Studio project (lib_json.vcproj) inside the "makefiles\vs71" directory (which should be included with the JSON files that you download from http://sourceforge.net/projects/jsoncpp/).
This Visual Studio project is for an older version of Visual Studio. However, if you open it within Visual Studio 2008, it should convert just fine, at which point you can build it within Visual Studio 2008, and then you should have the necessary .lib file you need for your project.

- 1
- 1

- 13,558
- 21
- 105
- 181
-
Thanks for your reply. So now how do I link my project to use jsoncpp, I mean I'll have to specify the path to the jsoncpp directory somewhere correct, in Visual studio? Is it somewhere in project properties that I specify the path to where my jsoncpp folder resides? – Tejas Apr 20 '12 at 15:06
-
Right-click on the project in the Solution Explorer, and select Project Settings (or whatever the name is). Then, dig around until you find the section of Linker settings. One of the many entries will be for "additional library paths". Type the path to the directory that contains the jsoncpp .lib file. (This can be relative, or the full path.) Then, there is another edit box somewhere where you can type the name of the jsoncpp .lib file (not including directory). Be sure to do all this for both Debug and Release. Then, build the project. – Dan Nissenbaum Apr 20 '12 at 15:45
-
But there is no jsoncpp.lib file in the jsoncpp project. I included the lib_json.vcproj project in my solution. So basically my solution at this moment contains my actual mfc project and lib_json.vcproj. I compile the entire solution, both projects compile fine. But when I include "json.h" file in one of the files of my mfc project, it is not able to find it. I am pretty sure I am missing something really obvious, but not exactly able to figure out what because of no prior experience with visual studio. – Tejas Apr 20 '12 at 18:36
-
I set the project dependency, the build order and also added a reference to jsoncpp project. But nothing seems to be working. – Tejas Apr 20 '12 at 19:01
-
You need to add the path to the json.h file in your other project - adding the json project as a dependency project won't do that for you. You can add the path either as a global preference (Tools -> Options -> Projects and Solutions -> VC++ Directories -> "Show Directories For" dropdown list -> "Include Files" -> then add the path. Or, in the Project Properties, C++ settings, find the "Include Directories" and add it there. – Dan Nissenbaum Apr 20 '12 at 22:34
-
-
Having tried everything, I decided to give the amalgamated version a try. And it worked ! – Tejas Apr 23 '12 at 18:09