manzerbredes/pgnp

Compilation error: missing `CMI.hpp` and `pgnp.hpp`

Closed this issue · 2 comments

I've encountered an issue when trying to compile the library manually with g++. I initially tried this because I wanted to understand more about how the project is structured. However, it seems the project might be intended to be used as a shared library with CMake integration only.

Here's the command I used to compile the source files:

g++ -c src/*.cpp -Iinclude. 

This resulted in the following errors:

objectivec

In file included from src/HalfMove.cpp:1:
src/HalfMove.hpp:8:10: fatal error: CMI.hpp: No such file or directory
    8 | #include "CMI.hpp"
      |          ^~~~~~~~~
compilation terminated.
src/PGN.cpp:2:10: fatal error: pgnp.hpp: No such file or directory
    2 | #include "pgnp.hpp"
      |          ^~~~~~~~~~
compilation terminated.

Upon checking the CMakeLists.txt file, it seems that CMI.hpp is part of the ChessMoveInterface library which is added as a subdirectory, while pgnp.hpp is expected to be located in the project directory, as it's included in the source files. However, neither of these files are available in the expected locations.

I understand that the recommended way to use the project is as a shared library with CMake integration, as per the usage section in the README. However, I would like to know if using CMake is required here, since I am using Make for my project.

Hello,
it is because you need to clone the repository recursively to include submodules with:
$ git clone --recursive <project-url>
I have a Makefile version here if you want a shorcut: https://filebrowser.loicguegan.com/api/public/dl/XmSl1Gp5

@manzerbredes Thank you, I used the makefile shortcut you provided and it worked. I followed the instructions as per the README, but I was forced to add a small modification to the includes.

I needed to replace

#include "CMI.hpp"

with

#include "../libs/chess-move-interface/includes/CMI.hpp"

in project_pgn/build/includes/HalfMove.hpp. I use the header file /project_pgn/pgnp/build/includes/pgnp.hpp to have access to the functionalities.