#11 won't build with GCC 4.3.1

closed-works-for-me
nobody
None
5
2011-07-06
2008-07-17
Anonymous
No

GCC 4.3.1's c++ header files avoid including as many C header files as they used to... which means that in the json-cpp code base, there are now some missing declarations of C string functions.

Errors when building with GCC 4.3.1:

src/lib_json/json_reader.cpp: In member function 'bool Json::Reader::decodeDouble(Json::Reader::Token&)':
src/lib_json/json_reader.cpp:522: error: 'memcpy' was not declared in this scope

src/lib_json/json_value.cpp: In member function 'virtual char* Json::DefaultValueAllocator::duplicateStringValue(const char*, unsigned int)':
src/lib_json/json_value.cpp:83: error: 'strlen' was not declared in this scope
src/lib_json/json_value.cpp:85: error: 'memcpy' was not declared in this scope
src/lib_json/json_value.cpp: In member function 'bool Json::Value::CZString::operator<(const Json::Value::CZString&) const':
src/lib_json/json_value.cpp:220: error: 'strcmp' was not declared in this scope
src/lib_json/json_value.cpp: In member function 'bool Json::Value::CZString::operator==(const Json::Value::CZString&) const':
src/lib_json/json_value.cpp:228: error: 'strcmp' was not declared in this scope
src/lib_json/json_value.cpp: In member function 'bool Json::Value::operator<(const Json::Value&) const':
src/lib_json/json_value.cpp:570: error: 'strcmp' was not declared in this scope
src/lib_json/json_value.cpp: In member function 'bool Json::Value::operator==(const Json::Value&) const':
src/lib_json/json_value.cpp:636: error: 'strcmp' was not declared in this scope
src/lib_json/json_value.cpp: In member function 'void Json::Path::makePath(const std::string&, const std::vector<const Json::PathArgument*, std::allocator<const Json::PathArgument*> >&)':
src/lib_json/json_value.cpp:1578: error: 'strchr' was not declared in this scope

Discussion

  • Nobody/Anonymous

    patch to fix the issue by including string.h.

     
  • Nobody/Anonymous

    you need to #include <string.h> at the top of src/lib_json/json_{reader,value}.cpp

    fixed it for me. please update!

     
  • Christopher Dunn

    Please post the compilation errors, not the fix. We have

    #include <cstring>

    so we would want to know whether that will suffice.

     
  • Christopher Dunn

    • status: open --> pending-works-for-me
     
  • Christopher Dunn

    Sorry. I meant post warnings with the latest code. I am using g++ 4.2 and see no problem. Perhaps we need the std:: namespace?

     
  • SourceForge Robot

    • status: pending-works-for-me --> closed-works-for-me
     
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     

Log in to post a comment.