Re: rapidjson?

Abdallah Elshamy <[email protected]>
Newsgroups gmane.comp.gnu.octave.maintainers
Message-ID <CAAVkm5CbSGYd+t5vyJN=FS-RfZc2v7ozHV3_wdtekMLqAfz=Gg@mail.gmail.com>
On Tue, Sep 29, 2020, 11:47 PM Dmitri A. Sergatskov <[email protected]>
wrote:

> On Fedora 33 configure cannot find working PrettyWriter in RapidJSON
> (1.1.0):
>
> configure:64508: checking for working PrettyWriter in RapidJSON
> configure:64539: g++ -c -O3 -march=native -flto=4 -fno-fat-lto-objects
> -pthread -fopenmp  conftest.cpp >&5
> In file included from conftest.cpp:494:
> /usr/include/rapidjson/prettywriter.h: In constructor
> 'rapidjson::PrettyWriter<OutputStream, SourceEncoding, TargetEncoding,
> StackAllocator, writeFlags>::PrettyWriter(OutputStream&, StackAllocator*,
> std::size_t) [with OutputStream =
> rapidjson::GenericStringBuffer<rapidjson::UTF8<> >; SourceEncoding =
> rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator =
> rapidjson::CrtAllocator; unsigned int writeFlags = 2; std::size_t = long
> unsigned int]':
> /usr/include/rapidjson/prettywriter.h:53:102: error: 'const size_t
> rapidjson::Writer<rapidjson::GenericStringBuffer<rapidjson::UTF8<> >
> >::kDefaultLevelDepth' is protected within this context
>    53 |     explicit PrettyWriter(OutputStream& os, StackAllocator*
> allocator = 0, size_t levelDepth = Base::kDefaultLevelDepth) :
>       |
>                                    ^~~~~~~~~~~~~~~~~~
> In file included from /usr/include/rapidjson/prettywriter.h:18,
>                  from conftest.cpp:494:
> /usr/include/rapidjson/writer.h:262:25: note: declared protected here
>   262 |     static const size_t kDefaultLevelDepth = 32;
>       |                         ^~~~~~~~~~~~~~~~~~
> conftest.cpp:511:75: note:   when instantiating default argument for call
> to 'rapidjson::PrettyWriter<OutputStream, SourceEncoding, TargetEncoding,
> StackAllocator, writeFlags>::PrettyWriter(OutputStream&, StackAllocator*,
> std::size_t) [with OutputStream =
> rapidjson::GenericStringBuffer<rapidjson::UTF8<> >; SourceEncoding =
> rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator =
> rapidjson::CrtAllocator; unsigned int writeFlags = 2; std::size_t = long
> unsigned int]'
>   511 |                               rapidjson::kWriteNanAndInfFlag>
> writer (json);
>       |
>         ^
> In file included from conftest.cpp:494:
> /usr/include/rapidjson/prettywriter.h: In instantiation of
> 'rapidjson::PrettyWriter<OutputStream, SourceEncoding, TargetEncoding,
> StackAllocator, writeFlags>::PrettyWriter(OutputStream&, StackAllocator*,
> std::size_t) [with OutputStream =
> rapidjson::GenericStringBuffer<rapidjson::UTF8<> >; SourceEncoding =
> rapidjson::UTF8<>; TargetEncoding = rapidjson::UTF8<>; StackAllocator =
> rapidjson::CrtAllocator; unsigned int writeFlags = 2; std::size_t = long
> unsigned int]':
> conftest.cpp:511:75:   required from here
> /usr/include/rapidjson/prettywriter.h:54:110: error: type
> 'rapidjson::Writer<rapidjson::GenericStringBuffer<rapidjson::UTF8<> > >' is
> not a direct base of
> 'rapidjson::PrettyWriter<rapidjson::GenericStringBuffer<rapidjson::UTF8<>
> >, rapidjson::UTF8<>, rapidjson::UTF8<>, rapidjson::CrtAllocator, 2>'
>    54 |         Base(os, allocator, levelDepth), indentChar_(' '),
> indentCharCount_(4), formatOptions_(kFormatDefault) {}
>       |
>                                            ^
> configure:64539: $? = 1
> configure: failed program was:
>
> Bug, or I am doing something wrong?
>
> Dmitri.
> --
>

No not a bug. To be able to use the "PrettyWriter" option you must use the
new version of RapidJSON from their repo on GitHub not the release.

Unfortunately, their last release was a few years ago so it looks like they
won't be releasing the new version soon.

Cheers,
Abdallah
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.