calref / cboe

Classic Blades of Exile
http://spiderwebforums.ipbhost.com/index.php?/forum/12-blades-of-exile/
Other
174 stars 42 forks source link

"Cannot open include file: 'clara.hpp': No such file or directory" when compiling with VS 2017 #462

Closed megablinken closed 1 week ago

megablinken commented 3 weeks ago

I've gotten the "Cannot open include file: 'clara.hpp': No such file or directory" when compiling with Visual Studio on two different Windows PCs. The first was a Win11 machine with Visual Studio Community 2022, and I thought maybe the newer version of VS was causing problems, so I tried again with a different Win10 machine with VS 2017, but I got the same error.

Here are my setup steps:

<<< INSTALL VC2017 >>> visual studio community 2017, installer downloaded from here: https://aka.ms/vs/15/release/vs_community.exe

Workloads: select Desktop development with C++ - left default settings selected, except Added: Windows 10 SDK (10.0.16299.0)

<<< INSTALL VCPKG >>> (open cmd window) cd \ git clone https://github.com/microsoft/vcpkg.git cd vcpkg bootstrap-vcpkg.bat -disableMetrics vcpkg.exe integrate install

Tried with and without adding vcpkg dir to the system PATH (and VPKG_ROOT). No difference.

<<< INSTALL VCPKG LIBS >>> Tried installing the libs in manifest mode, and without manifest mode. No difference.

Without manifest mode, I installed them using this command: vcpkg install --triplet=x86-windows zlib sfml opengl boost-any boost-dynamic-bitset boost-ptr-container boost-core boost-filesystem boost-system boost-date-time boost-chrono boost-math boost-spirit

It seems to also need cppcodec, so I installed it also: vcpkg install --triplet=x86-windows cppcodec

<<< INSTALL BOE SRC >>> (open cmd window) cd \ md BoE cd BoE git clone https://github.com/calref/cboe.git

<< COMPILE >> Launch Visual Studio Open C:\BoE\cboe\proj\vs2017\Blades of Exile.sln Select Debug and x86 Unload everything but Common and BoE Build

Always get this error: Severity Code Description Project File Line Suppression State Error C1083 Cannot open include file: 'clara.hpp': No such file or directory Blades of Exile c:\boe\cboe\src\tools\cli.hpp 4

It looks like clara is expected to be part of the Catch namespace, but none of the catch* packages available for install via vcpkg fix this. I tried installing "catch2", "catch", and "catch-classic" (in this order): vcpkg install --triplet=x86-windows catch2 vcpkg install --triplet=x86-windows catch vcpkg install --triplet=x86-windows catch-classic

Installing the "clara" package via vspkg makes the "No such file or directory" error go away, but then I get a namespace error because it isn't part of the Catch namespace: vcpkg install --triplet=x86-windows clara

Help! I'm so close!

NQNStudios commented 3 weeks ago

Can you try this command in the root folder of your clone: git submodule update —init?

We get the clara dependency in a submodule. We wish we could make the submodules clone automatically because they’re required but git/github don’t allow that.

On Fri, Nov 1, 2024 at 9:44 AM megablinken @.***> wrote:

I've gotten the "Cannot open include file: 'clara.hpp': No such file or directory" when compiling with Visual Studio on two different Windows PCs. The first was a Win11 machine with Visual Studio Community 2022, and I thought maybe the newer version of VS was causing problems, so I tried again with a different Win10 machine with VS 2017, but I got the same error.

Here are my setup steps:

<<< INSTALL VC2017 >>> visual studio community 2017, installer downloaded from here: https://aka.ms/vs/15/release/vs_community.exe

Workloads: select Desktop development with C++ - left default settings selected, except Added: Windows 10 SDK (10.0.16299.0)

<<< INSTALL VCPKG >>> (open cmd window) cd git clone https://github.com/microsoft/vcpkg.git cd vcpkg bootstrap-vcpkg.bat -disableMetrics vcpkg.exe integrate install

Tried with and without adding vcpkg dir to the system PATH (and VPKG_ROOT). No difference.

<<< INSTALL VCPKG LIBS >>> Tried installing the libs in manifest mode, and without manifest mode. No difference.

Without manifest mode, I installed them using this command: vcpkg install --triplet=x86-windows zlib sfml opengl boost-any boost-dynamic-bitset boost-ptr-container boost-core boost-filesystem boost-system boost-date-time boost-chrono boost-math boost-spirit

It seems to also need cppcodec, so I installed it also: vcpkg install --triplet=x86-windows cppcodec

<<< INSTALL BOE SRC >>> (open cmd window) cd md BoE cd BoE git clone https://github.com/calref/cboe.git

<< COMPILE >> Launch Visual Studio Open C:\BoE\cboe\proj\vs2017\Blades of Exile.sln Select Debug and x86 Unload everything but Common and BoE Build

Always get this error: Severity Code Description Project File Line Suppression State Error C1083 Cannot open include file: 'clara.hpp': No such file or directory Blades of Exile c:\boe\cboe\src\tools\cli.hpp 4

It looks like clara is expected to be part of the Catch namespace, but none of the catch* packages available for install via vcpkg fix this. I tried installing "catch2", "catch", and "catch-classic" (in this order): vcpkg install --triplet=x86-windows catch2 vcpkg install --triplet=x86-windows catch vcpkg install --triplet=x86-windows catch-classic

Installing the "clara" package via vspkg makes the "No such file or directory" error go away, but then I get a namespace error because it isn't part of the Catch namespace: vcpkg install --triplet=x86-windows clara

Help! I'm so close!

— Reply to this email directly, view it on GitHub https://github.com/calref/cboe/issues/462, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATXBKOMMWYSIUDPR6QIKTTZ6OHU3AVCNFSM6AAAAABRAMQMYWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGYZDSMJYGQ4TKMI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

NQNStudios commented 3 weeks ago

I was on the go when I first responded (and what I suggested should fix this).

Now I'm home, reading your issue more in depth, and want to address it more because clearly you went to a lot of work trying to solve this, and there must be a way we can improve our documentation because it could have saved you a real headache.

Catch2 and cppcodec are both provided in submodules. I didn't realize you could vcpkg install cppcodec--maybe that is another working way to get that dependency. But with Clara, we are locked in on a version of it that you won't find from vcpkg--that's why it has to be a submodule, our version of Catch2/clara is pretty much frozen in time. git clone --recursive or git submodule update --init are the solution here.

Could you let me know where you were looking in the docs that led you to try vcpkg to solve these things? That might help me figure out how to improve the docs.

CelticMinstrel commented 2 weeks ago

The version of Catch2 installed from vcpkg is most likely the 3.x series. Since Clara itself is discontinued and no longer maintained, it wouldn't surprise me at all if the 3.x series no longer includes it. We require the 2.x series of Catch2 though, as the 3.x series doesn't work with C++11. Thus, our Catch2 is, as NQN said, frozen in time at the final release of the 2.x series.

megablinken commented 2 weeks ago

The version of Catch2 installed from vcpkg is most likely the 3.x series. Since Clara itself is discontinued and no longer maintained, it wouldn't surprise me at all if the 3.x series no longer includes it. We require the 2.x series of Catch2 though, as the 3.x series doesn't work with C++11. Thus, our Catch2 is, as NQN said, frozen in time at the final release of the 2.x series.

I wondered if that was the case. I saw that only the 2.x branch of Catch2 supported C++11, and I figured that might be the issue. I tried to find a way to install a branch of a package using vcpkg, but I was unsuccessful.

Do you know if there's a way to install a branch of package using vcpkg? I can't imagine everyone would always want the latest release of every package.

NQNStudios commented 2 weeks ago

When I looked into doing that, what I saw seemed complicated and painful.

On Mon, Nov 4, 2024 at 10:55 AM megablinken @.***> wrote:

The version of Catch2 installed from vcpkg is most likely the 3.x series. Since Clara itself is discontinued and no longer maintained, it wouldn't surprise me at all if the 3.x series no longer includes it. We require the 2.x series of Catch2 though, as the 3.x series doesn't work with C++11. Thus, our Catch2 is, as NQN said, frozen in time at the final release of the 2.x series.

I wondered if that was the case. I saw that only the 2.x branch of Catch2 supported C++11, and I figured that might be the issue. I tried to find a way to install a branch of a package using vcpkg, but I was unsuccessful.

Do you know if there's a way to install a branch of package using vcpkg? I can't imagine everyone would always want the latest release of every package.

— Reply to this email directly, view it on GitHub https://github.com/calref/cboe/issues/462#issuecomment-2455224018, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATXBKMVYT5VIJYCB2XGKTLZ66KGLAVCNFSM6AAAAABRAMQMYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJVGIZDIMBRHA . You are receiving this because you commented.Message ID: @.***>

megablinken commented 2 weeks ago

I was on the go when I first responded (and what I suggested should fix this).

Now I'm home, reading your issue more in depth, and want to address it more because clearly you went to a lot of work trying to solve this, and there must be a way we can improve our documentation because it could have saved you a real headache.

Catch2 and cppcodec are both provided in submodules. I didn't realize you could vcpkg install cppcodec--maybe that is another working way to get that dependency. But with Clara, we are locked in on a version of it that you won't find from vcpkg--that's why it has to be a submodule, our version of Catch2/clara is pretty much frozen in time. git clone --recursive or git submodule update --init are the solution here.

Could you let me know where you were looking in the docs that led you to try vcpkg to solve these things? That might help me figure out how to improve the docs.

git submodule update --init worked. Thank you!

I tried vcpkg because there were already instructions to install other packages with it. I took a stab at resolving the cppcodec problem, and after googling the error that I got, and then finding that dependency could be resolved with vcpkg, I figured the Catch2/clara issue was probably the same problem.

I don't use git very much, so I'm not very familiar with it. It never occurred to me that the dependencies would be resolved via submodules.

To be honest, I think the first time I tried compiling, I didn't use "git clone" at all. I probably downloaded the zip archive of the repo. I'm never going to check in changes, so it seems simpler.

I see now that Catch2 is listed under dependencies, but it is prefaced with: "if you want to build the unit tests". I didn't want to build the unit tests. Unless building the unit tests is enabled by default, Catch2 looks to be a dependency of the core application. I can build the "Common" project without it, but the "Blades of Exile" project fails. "src\tools\cli.hpp" is listed as an external dependency for that project, and it needs "clara.hpp".

If I can respectfully give some advice, I would recommend adding a section to the README.md before "Building" called something like "Getting The Source", which lists the first steps as calling "git clone" and "git submodule" for the packages that won't be managed by the build system.

Also, it's unclear if vcpkg "manifest mode" should be used. There's a manifest file in the VS project root, but the instructions say to install the packages manually. I know practically nothing about this tool, but if all things are equal, using "manifest mode" is much easier.

Thank you for the help, sorry if I've over-stepped with the commentary. It is intended only to be constructive. I have the utmost respect for the maintainers of open-source projects. It's a thankless job, and the internet is filled with illiterate idiots. I appreciate all your effort.

megablinken commented 2 weeks ago

When I looked into doing that, what I saw seemed complicated and painful.

Well, it is an MS product, so that goes without saying.

NQNStudios commented 2 weeks ago

Your input is very welcome and well received!

On Mon, Nov 4, 2024 at 11:50 AM megablinken @.***> wrote:

When I looked into doing that, what I saw seemed complicated and painful.

Well, it is an MS product, so that goes without saying.

— Reply to this email directly, view it on GitHub https://github.com/calref/cboe/issues/462#issuecomment-2455346681, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATXBKMVKB37UDHO3GI3GBLZ66QV3AVCNFSM6AAAAABRAMQMYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJVGM2DMNRYGE . You are receiving this because you commented.Message ID: @.***>

CelticMinstrel commented 2 weeks ago

I probably downloaded the zip archive of the repo.

I suspect that's often not a safe way to obtain a copy of a repository from GitHub. In general I'd recommend not using the automatic zip unless the project is something very simple.

Unless building the unit tests is enabled by default, Catch2 looks to be a dependency of the core application.

It recently became a dependency of the core application as well, yes. The core application doesn't use Catch itself, but it uses the Clara module that is bundled with Catch. It seems we missed updating some of the documentation when that happened.

CelticMinstrel commented 1 week ago

The readme has been improved by #464.