nlohmann / json

JSON for Modern C++
https://json.nlohmann.me
MIT License
42.4k stars 6.67k forks source link

Json package not compiling properly #4042

Closed Felli86 closed 1 year ago

Felli86 commented 1 year ago

Description

I am using a Physics console app that used 'json' as a dependency, and when i compile it it throws an error

Reproduction steps

git clone --recurse-submodules git@git.km3net.de:oscillation/Swim.git

cd swim

make

Expected vs. actual results

to compile properly instead of throwing the error

Minimal code example

No response

Error messages

felli@felli-HP-EliteBook-Revolve-810-G3:~/Gits/Swim$ make
OscProb:
  Making dictionary for MatrixDecomp...
  Building MatrixDecomp...
  Making dictionary for OscProb...
  Building OscProb...
 nCreating symlink to OscProb library...
Copying OscProb binding for cling interpreter...
EvtTree:
  Making dictionary for EvtTree...
  Compiling EvtTree...
UtilsOrca:
  Making dictionary for UtilsOrca...
  Compiling UtilsOrca...
InputModels:
  Making dictionary for InputModels...
  Compiling InputModels...
OrcaDet:
  Making dictionary for OrcaDet...
  Compiling OrcaDet...
NuFitter:
  Making dictionary for NuFitter...
  Compiling NuFitter...
OrcaSyst:
  Making dictionary for OrcaSyst...
  Compiling OrcaSyst...
OrcaSim:
  Making dictionary for OrcaSim...
  Compiling OrcaSim...
ParseFitter:
  Making dictionary for ParseFitter...
  Compiling ParseFitter...
In file included from /home/felli/Gits/Swim/ParseFitter/../json/include/nlohmann/detail/value_t.hpp:16,
                 from /home/felli/Gits/Swim/ParseFitter/../json/include/nlohmann/detail/exceptions.hpp:20,
                 from /home/felli/Gits/Swim/ParseFitter/../json/include/nlohmann/detail/conversions/from_json.hpp:23,
                 from /home/felli/Gits/Swim/ParseFitter/../json/include/nlohmann/adl_serializer.hpp:14,
                 from /home/felli/Gits/Swim/ParseFitter/../json/include/nlohmann/json.hpp:34,
                 from /home/felli/Gits/Swim/ParseFitter/ParseFitter.h:19,
                 from /home/felli/Gits/Swim/ParseFitter/ParseFitter.cxx:1:
/home/felli/Gits/Swim/ParseFitter/../json/include/nlohmann/detail/macro_scope.hpp:249:63: error: wrong number of template arguments (11, should be at least 0)
  249 |     AllocatorType, JSONSerializer, BinaryType, CustomBaseClass>
      |                                                               ^
/home/felli/Gits/Swim/ParseFitter/../json/include/nlohmann/detail/meta/type_traits.hpp:52:22: note: in expansion of macro ‘NLOHMANN_BASIC_JSON_TPL’
   52 | struct is_basic_json<NLOHMANN_BASIC_JSON_TPL> : std::true_type {};
      |                      ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/felli/Gits/Swim/ParseFitter/../json/include/nlohmann/detail/meta/type_traits.hpp:22,
                 from /home/felli/Gits/Swim/ParseFitter/../json/include/nlohmann/detail                                                                 ^~~~~~~~~~~~~~~~~~~~~~~
.................................
................................. removed form brevity .................................. 
In file included from /home/felli/Gits/Swim/ParseFitter/ParseFitter.h:19,
                 from /home/felli/Gits/Swim/ParseFitter/../tmp/libParseFitter.cxx:38:
/home/felli/Gits/Swim/ParseFitter/../json/include/nlohmann/json.hpp:5202:92: error: ‘j2’ was not declared in this scope; did you mean ‘jn’?
 5202 | inline void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL& j1, nlohmann::NLOHMANN_BASIC_JSON_TPL& j2) noexcept(  // NOLINT(readability-inconsistent-declaration-parameter-name, cert-dcl58-cpp)
      |                                                                                            ^~
      |                                                                                            jn
/home/felli/Gits/Swim/ParseFitter/../json/include/nlohmann/json.hpp:5215:58: error: ‘operator""_json_pointer’ has not been declared in ‘nlohmann::json_abi_v3_11_2::literals::json_literals’
 5215 |     using nlohmann::literals::json_literals::operator "" _json_pointer; //NOLINT(misc-unused-using-decls,google-global-names-in-headers)
      |                                                          ^~~~~~~~~~~~~
In file included from /home/felli/Gits/Swim/ParseFitter/../tmp/libParseFitter.cxx:38:
/home/felli/Gits/Swim/ParseFitter/ParseFitter.h:83:10: error: field ‘data’ has incomplete type ‘nlohmann::json’ {aka ‘nlohmann::basic_json<>’}
   83 |     json data;                ///< Internal json object
      |          ^~~~
In file included from /home/felli/Gits/Swim/ParseFitter/../json/include/nlohmann/detail/meta/type_traits.hpp:22,
                 from /home/felli/Gits/Swim/ParseFitter/../json/include/nlohmann/detail/exceptions.hpp:25,
                 from /home/felli/Gits/Swim/ParseFitter/../json/include/nlohmann/detail/conversions/from_json.hpp:23,
                 from /home/felli/Gits/Swim/ParseFitter/../json/include/nlohmann/adl_serializer.hpp:14,
                 from /home/felli/Gits/Swim/ParseFitter/../json/include/nlohmann/json.hpp:34,
                 from /home/felli/Gits/Swim/ParseFitter/ParseFitter.h:19,
                 from /home/felli/Gits/Swim/ParseFitter/../tmp/libParseFitter.cxx:38:
/snap/root-framework/924/usr/local/include/nlohmann/json_fwd.hpp:40:7: note: declaration of ‘using json = class nlohmann::basic_json<>’ {aka ‘class nlohmann::basic_json<>’}
   40 | class basic_json;
      |       ^~~~~~~~~~
In file included from /home/felli/Gits/Swim/ParseFitter/../tmp/libParseFitter.cxx:38:
/home/felli/Gits/Swim/ParseFitter/ParseFitter.h:49:20: error: return type ‘using json = class nlohmann::basic_json<>’ {aka ‘class nlohmann::basic_json<>’} is incomplete
   49 |     json GetJSON() { return data; } ///< Get a copy of the json object
      |                    ^
make[1]: *** [../standard.mk:53: /home/felli/Gits/Swim/ParseFitter/../lib/libParseFitter.so] Error 1
make: *** [Makefile:34: ParseFitter] Error 2
felli@felli-HP-EliteBook-Revolve-810-G3:~/Gits/Swim$

Compiler and operating system

Ubuntu 22.04 TLS, C++ version 11.3.0

Library version

3.11.2

Validation

nlohmann commented 1 year ago

Please report the error in the client project.