I have downloaded jsoncpp and successfully built it; I also issued the command “scons platform=linux-gcc check” to run the tests – the all passed.


I then created my own program to actually test this; the program compiles and links fine – but it goes down witn SIGSEGV when running. My program is


#include <json/json.h>


void parseJson() {

    Json::Reader reader;



int main(int argc , char ** argv) {





I.e. it is very simple stuff. When I try putting the Json::Reader instance in the boyd of main{…} it seems to work.  A backtrace from gdb is inlined below:


#0  0x0000003a560b7672 in __gnu_cxx::__exchange_and_add () from /usr/lib64/libstdc++.so.6

#1  0x0000000000403313 in std::string::_Rep::_M_dispose (this=0xffffffffffffffe9, __a=@0x7fff7fb14957)

    at /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h:232

#2  0x0000000000403360 in ~basic_string (this=0x7fff7fb14ab0)

    at /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h:478

#3  0x00000000004039fe in ~Reader (this=0x7fff7fb149b0) at /private/joaho/Parser/opm-parser/external/json/json-cpp/include/json/reader.h:23

#4  0x0000000000402aba in parseJson () at /private/joaho/Parser/opm-parser/opm/parser/eclipse/ExternalTests/ExternalTests.cpp:50

#5  0x0000000000402ad5 in main (argc=1, argv=0x7fff7fb14bc8)

    at /private/joaho/Parser/opm-parser/opm/parser/eclipse/ExternalTests/ExternalTests.cpp:55


As you can see I have a very old version of g++ (4.1.2). I am in a corporate environment and it is quite painful to get a newer version – do you think this can be the problem?


Regards Joakim



The information contained in this message may be CONFIDENTIAL and is
intended for the addressee only. Any unauthorised use, dissemination of the
information or copying of this message is prohibited. If you are not the
addressee, please notify the sender immediately by return e-mail and delete
this message.
Thank you