Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version file causes errors when a file in the project includes <version> #544

Open
CalcProgrammer1 opened this issue Aug 6, 2024 · 0 comments

Comments

@CalcProgrammer1
Copy link

CalcProgrammer1 commented Aug 6, 2024

https://en.cppreference.com/w/cpp/header/version

<version> is a standard header name in C++20, so there is the possibility that files within a given project include it. The version file in this project can cause issues if this happens as it is not valid C++ code and instead just a text file that contains a version number. I would recommend changing this file's name so that it doesn't clash with a known C++ standard header name.

When pulling this library into my project, I am running into this issue because the nlohmann json library I also use has #include <version>. Here is a build log for reference:

In file included from /builds/CalcProgrammer1/OpenRGB/dependencies/json/json.hpp:2404,
                 from /builds/CalcProgrammer1/OpenRGB/SettingsManager.h:16,
                 from /builds/CalcProgrammer1/OpenRGB/qt/DetectorTableModel.cpp:11:
/builds/CalcProgrammer1/OpenRGB/dependencies/rpi_ws281x/version:1:1: error: too many decimal points in number
    1 | 1.1.0
      | ^~~~~

I've included the rpi_ws281x directory in my project's include directories list, which is necessary for the actual header files to be picked up. The alternative would be to move all the include files into an include/inc directory so that version is not picked up when the path is included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant