This is a starter project for the Image Processing laboratories at UTCN.
This document will present a sample idea in order to get set up on VS Code for C++ development with the OpenCV framework using MSYS2 + UCRT with the LLVM Clang compiler / LLDB debugger, Ninja build system and CMake
Download and install MSYS2 (https://www.msys2.org/#installation) which will give you the capability to install ArchLinux based packages under Windows.
Once it has been installed, start a UCRT64 based shell
Inside the shell, install the necessary packages for development.
These can be found at https://packages.msys2.org/package/
Required MSYS2 Packages
pacman -S base-devel mingw-w64-ucrt-x86_64-clang mingw-w64-ucrt-x86_64-lldb mingw-w64-ucrt-x86_64-ninja mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-opencv mingw-w64-ucrt-x86_64-qt6-5compat
Once the packages have been successfully installed, then close the shell.
Next, you will need to add bin
and the lib
directories MSYS2's UCRT location where the packages were installed to the Path
environment variable
First open Edit environment variables for your account from the Start Menu
then search for the Path
variable and click on Edit...
Now you will need to add two new entries, one for the bin
, and one for the lib
directory
Make sure to use the path where you installed MSYS2
So, if it was installed under the default C:\msys2
directory, then you would add the following
Once completed, click OK ... OK ... OK to close the dialogs and the settings pane
Next you will need to install an extension that will help you with some of underlying functionalities and setup
The C/C++ Extension Pack is highly recommended for simplicity
Afterwards, once you have cloned or set up the project, make sure to select the kit that corresponds to the one that you have installed in MSYS2 UCRT
By default, the kits might not be configured and listed, and in that case you will have to click on the Scan for kits option for it to first find
If you correctly added it to the path inside the environment variables, then VS Code should locate it
On the picture below you can see the installed compilers, and you will want to select the x86_64-w64-windows-gnu option, which in this is case is the first one below Unspecified
Afterwards, you should be able to build / run your project