Skip to content
/ opencv-proba Public template

Starter app for Image Processing labs at UTCN

Notifications You must be signed in to change notification settings

FuzzyAtish/opencv-proba

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IP labs setup for Win with MSYS2 + Clang

PREFACE

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

INSTALLING MSYS2 AND REQUIRED PACKAGES

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

1_msys2_ucrt64.png

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

2_pacman.png

Once the packages have been successfully installed, then close the shell.

Setting up Windows environment variables

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

3_start_menu.png

then search for the Path variable and click on Edit...

4_edit_env.png

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

5_add_to_path.png

Once completed, click OK ... OK ... OK to close the dialogs and the settings pane

Install VS Code extensions

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

6_code_cpp_extension_pack.png

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

7_code_cpp_kit.png

Afterwards, you should be able to build / run your project