Little-Eye / pace-2024

MIT License
0 stars 0 forks source link

Compilation Error #1

Open PhKindermann opened 3 days ago

PhKindermann commented 3 days ago

Hey,

I tried to compile your program, but I'm getting errors. First, I got a huge list of errors (I have a 800kb file that I can send you, if you want). I got rid of most of them by setting CMAKE_CXX_STANDARD to 17 in CMakeLists.txt, but one error remains:

[ 83%] Building CXX object CMakeFiles/OCM.dir/home/philipp/2024-pace-submissions/heuristic/13-kongqi/pace-2024-pace-2024/Test/TestCoreOCM.cpp.o
In file included from /home/philipp/2024-pace-submissions/heuristic/13-kongqi/pace-2024-pace-2024/Test/TestCoreOCM.cpp:14:
/home/philipp/2024-pace-submissions/heuristic/13-kongqi/pace-2024-pace-2024/Build/Linux/../../GOAL/ThirdParty/Protobuf.h: In function ‘std::string goal::protobufToJson(const T&, bool)’:
/home/philipp/2024-pace-submissions/heuristic/13-kongqi/pace-2024-pace-2024/Build/Linux/../../GOAL/ThirdParty/Protobuf.h:37:13: error: ‘using JsonPrintOptions = struct google::protobuf::json::PrintOptions’ {aka ‘struct google::protobuf::json::PrintOptions’} has no member named ‘always_print_primitive_fields’
   37 |     options.always_print_primitive_fields = true;
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/OCM.dir/build.make:132: CMakeFiles/OCM.dir/home/philipp/2024-pace-submissions/heuristic/13-kongqi/pace-2024-pace-2024/Test/TestCoreOCM.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/OCM.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Do you have any idea what I can do to fix this error? I'm using Ubuntu 22.04 LTS.

Best Philipp

PhKindermann commented 3 days ago

OK, I got it to work, following this issue of another project that had the same problem: https://github.com/rizsotto/Bear/issues/566

In GOAL/ThirdParty/Protobuf.h, I replaced line 37

options.always_print_primitive_fields = true;

by

#if GOOGLE_PROTOBUF_VERSION < 5026000
    options.always_print_primitive_fields = true;
#endif

Together with the change in CMakeLists.txt outlined above, I could now compile the code.