Skip to content

Commit e922be4

Browse files
committed
fix: include order when building with -DCXXOPTS_USE_UNICODE
This change fixes a bizarre build failure that happens when trying to build docling-parse with system cxxopts that define `CXXOPTS_USE_UNICODE`. The error causes implicit conversion from boolean types to fail, causing errors like this: ``` In file included from /build/docling_parse-5.7.0/src/parse.h:44, from /build/docling_parse-5.7.0/app/parse_fonts.cpp:17: /build/docling_parse-5.7.0/src/parse/config.h: In member function ‘nlohmann::json_abi_v3_12_0::json pdflib::decode_config::to_json() const’: /build/docling_parse-5.7.0/src/parse/config.h:60:58: error: no matching function for call to ‘nlohmann::json_abi_v3_12_0::basic_json<>::basic_json(const bool&)’ 60 | j["do_sanitization"] = nlohmann::json(do_sanitization); | ^ ``` Signed-off-by: Attila Oláh <attila@dorn.haus>
1 parent efebb9f commit e922be4

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/parse.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@
2222
#endif
2323

2424
// specific libraries
25+
// NOTE: json.hpp must be included *before* cxxopts.hpp.
26+
// See https://github.com/docling-project/docling-parse/pull/248 for details.
27+
#include <nlohmann/json.hpp>
2528
#include <cxxopts.hpp>
2629

2730
#define LOGURU_WITH_STREAMS 1
2831
#include <loguru.hpp>
2932

3033
//#include <utf8/utf8.h>
3134
#include <utf8.h>
32-
#include <nlohmann/json.hpp>
3335

3436
#define POINTERHOLDER_TRANSITION 0 // eliminate warnings from QPDF
3537
#include <qpdf/QPDF.hh>

0 commit comments

Comments
 (0)