0

埋め込みターゲットで使用している RapidJSON で問題に直面しています。Windows では、すべてが魔法のように機能します。

次の簡単なテストは、私のターゲットでは機能しません。

#include "rapidjson/document.h"
#include "rapidjson/prettywriter.h"
#include "rapidjson/error/en.h"

using namespace rapidjson;

std::string temp = "{ \"Checksum\": 12345678912344567, \"Parameters\": [ 1, 2, 3 ] }" ;

Document json;
json.Parse( temp.c_str() );

if ( json.HasParseError() )
{
    Logger::Log( Logger::ERROR, GetParseError_En( json.GetParseError() ),
                                "Read" );
    return NULL;
}

if ( !json.IsObject() )
{
   Logger::Log( Logger::ERROR, "Problems parsing the JSON file: " + filename,
                               "Read" );
   return NULL;
}

解析はエラーを返しません。JSON にエラーを追加すると、RapidJSON は (ターゲット上でも) エラーを正しく報告します。

json.GetType() は 180 (dec) を返し、IsInt64()、IsUint64()、および IsDouble() は true を返します。

ゲッターの結果:

json.GetUint64() -> 269079258591236 
json.GetInt64()  -> 269079258591236 
json.GetDouble() -> 0

私のコンパイラフラグ:

gnu_arm_4.7.4_20130913/bin/arm-none-eabi-g++.exe -DBOOST_ALL_NO_LIB -DBOOST_HAS_STDINT_H \
-DBOOST_LEXICAL_CAST_ASSUME_C_LOCALE -DBOOST_NO_STD_LOCALE -DBSPCFG_ENABLE_CPP -DMQX_ENABLE_CPP \
-DMQX_SUPPRESS_FILE_DEF -DRAPIDJSON_HAS_STDSTRING -mcpu=cortex-a5 -mfloat-abi=hard -mfpu=neon-vfpv4 \
-g -D__MQXOS__ -D__GNU__ -D__STRICT_ANSI__  -nostdinc -mthumb -mthumb-interwork -mno-unaligned-access \
-fcommon -ffreestanding -fno-builtin -ftree-vectorize -DGTF_STATIC_BUILD -fvisibility=hidden -Wall \
-Wshadow -Wno-invalid-offsetof -Wuninitialized -fno-strict-aliasing -fshort-enums -fno-exceptions \
-fno-rtti -pipe -fPIC -O3 -DNDEBUG

対象OSはFreescale(現NXP)のMQXというリアルタイムシステム。

ヒントはありますか?何が問題なのですか?

ありがとう

4

0 に答える 0