BTW, frek, I have to thank you for pushing me to figuring out how to properly use vcpkg. I'd dinked around in the past, and gave up with the impression it was harder to work with than it actually is.
I've successfully installed for x86 and x64 Catch2. I noticed there are .md docs in the installed directories, so I peeked and LO! Decent documentation on using Catch2.
Still I can't use Catch2 in my IDE: VS 2022 (community)
As I said in my previous post, I get the following two errors when I include the header: #include <catch.hpp>
Severity Code Description Project File Line Suppression State
Error (active) E1696 cannot open source file "catch.hpp"
Severity Code Description Project File Line Suppression State
Error C1083 Cannot open include file: 'catch.hpp': No such file or directory
As well as, I searched for that header file (catch.hpp) in the vcpkg folder. There's not such a file there either! :|
Do you have an installed folder under where you installed vcpgk? Installed packages go there. Inside subfolders for x86 and x64 versioning.
There's a folder with the same name as vcpkg right inside it. That is, the path from the C drive to the subfolders and files is this way: C:\dev\vcpkg\vcpkg
Did you vcpgk integrate install before you installed Catch2? That is key to getting the installed packages to be discoverable by VS without a hassle.
As stated in my prior post, I firstly cloned the vcpkg.git file from its git repository as written in the link. Then ran the following two command one after another: .\vcpkg\bootstrap-vcpkg.bat
vcpkg integrate install
For example this is the output of CMD when running the last command:
C:\dev\vcpkg\vcpkg>vcpkg integrate install
Applied user-wide integration for this vcpkg root.
All MSBuild C++ projects can now #include any installed libraries.
Linking will be handled automatically.
Installing new libraries will make them instantly available.
CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=C:/dev/vcpkg/vcpkg/scripts/buildsystems/vcpkg.cmake"
C:\dev\vcpkg\vcpkg>
Try vcpkg list, that shows all packages you've got installed.
I get this for that command! C:\dev\vcpkg\vcpkg>vcpkg list
No packages are installed. Did you mean `search`?
This round of hassles is why I gave up when I tried to use vcpgk earlier. Trying to help you helped me to get a better handle on how vcpkg works.
Somehow you buried vcpgk one directory down into a second vcpkg folder. Navigate to that second vcpkg dir and look to see if there is an installed folder. As well as a lot of other folders like .github, buildtrees, docs, etc. along with a bunch of standalone files including vcpkg.exe. If you find that in the second vcpk dir then things aren't so dire.
I'm figuring out that you don't want to actually be IN the directory where you want to install vcpkg when you do the git clone, you want to be one dir UP. The git clone creates the vcpkg dir for you.
For instance, if you want vcpkg to be in C:\dev\vcpkg when it is installed, then issue the git clone command from C:\dev.
The "getting started" instructions could be better written.
As you see there're many files and subfolders there but not one named "installed"!
I don't know how many folders I should create and within which I should run the git clone command!
Firstly I created two folders: dev and inside it vcpkg and inside that vcpkg ran the git clone command. VS didn't recognize the header.
Secondly, removed the previous folder and start from beginning by creating only one folder called dev and from within that ran the git clone command. Yet, VS doesn't recognize the header! :(
Notice NO installed folder yet. You haven't installed catch2 (or any libraries) yet.
Before we continue let's do a bit of basic house-keeping....
Start a project in VS, any project. New or existing one.
Check the project's properties. Do you see an entry under Configurations Properties for vcpkg? Likely near the top of the list. It is the 3rd entry for me.
If not, then you haven't done the global integration yet as far as VS and vcpkg are concerned. DO NOT issue the global integration command just yet! That is another step we will do in a bit.
If you do see vcpkg in the Configuration Properties we are along the right path towards success. Still not there yet, but one step closer.
To ensure you get a working vcpkg install properly integrated into VS please let's do this one step at a time. You've got what looks like a good vcpkg install in C:\dev\vcpkg. I'll walk you through each step I used to get it to work for me.
So you know the intricacies of how it works, etc.
A plus is anyone who hasn't worked with vcpkg before can benefit from both of our trials and tribulations experience. :)
After vcpkg integrate install command I searched for "Catch2" on CMD and then installed it. Now Visual Studio recognizes the header and "vcpkg" is also the third entry in Configuration Properties.
Is it now done for installing and enabling Catch2 on my IDE, please? :)
Issue a vcpkg list command. To properly use catch2 I recommend you have two versions installed.
One for x86, another for x64.
Here's my installed packages list:
catch2:x64-windows 2.13.8 A modern, header-only test framework for unit te...
catch2:x86-windows 2.13.8 A modern, header-only test framework for unit te...
fmt:x64-windows 8.1.0 Formatting library for C++. It can be used as a ...
fmt:x86-windows 8.1.0 Formatting library for C++. It can be used as a ...
vcpkg-cmake-config:x64-windows 2021-12-28
vcpkg-cmake-config:x86-windows 2021-12-28
vcpkg-cmake:x64-windows 2021-12-20
vcpkg-cmake:x86-windows 2021-12-20
C:\dev\vcpkg\vcpkg>vcpkg list
catch2:x86-windows 2.13.8 A modern, header-only test framework for unit te...
vcpkg-cmake-config:x64-windows 2022-02-06
vcpkg-cmake:x64-windows 2022-01-19
C:\dev\vcpkg\vcpkg>vcpkg list
catch2:x64-windows 2.13.8 A modern, header-only test framework for unit te...
catch2:x86-windows 2.13.8 A modern, header-only test framework for unit te...
vcpkg-cmake-config:x64-windows 2022-02-06
vcpkg-cmake:x64-windows 2022-01-19
C:\dev\vcpkg\vcpkg>
C:\dev\vcpkg\vcpkg>vcpkg list
catch2:x64-windows 2.13.8 A modern, header-only test framework for unit te...
catch2:x86-windows 2.13.8 A modern, header-only test framework for unit te...
vcpkg-cmake-config:x64-windows 2022-02-06
vcpkg-cmake-config:x86-windows 2022-02-06
vcpkg-cmake:x64-windows 2022-01-19
vcpkg-cmake:x86-windows 2022-01-19
C:\dev\vcpkg\vcpkg>