This repository contains code snippets and implementations of various deep learning concepts, algorithms, and techniques. It serves as a collection of practical examples to help understand and explore key principles in deep learning.
This guide will walk you through the process of setting up a development environment for C++ with OpenCV and Qt using MSYS2, as well as configuring Visual Studio Code (VSCode) for development. By the end of this guide, you will have all the necessary tools installed and configured to start working on your C++ projects with OpenCV and Qt on Windows.
-
Clone the Repository:
- First, clone this repository to your local machine. Open a terminal (such as Command Prompt or Git Bash) and run the following command:
git clone https://github.com/takuphilchan/Deep-Learning.git
- First, clone this repository to your local machine. Open a terminal (such as Command Prompt or Git Bash) and run the following command:
-
Navigate to the Project Folder:
- Once the repository is cloned, navigate to the project folder:
cd "Deep Learning"
- Once the repository is cloned, navigate to the project folder:
-
Download VSCode:
- Visit the Visual Studio Code website and download the latest stable version of VSCode for Windows.
-
Install VSCode:
- Run the installer and follow the installation instructions. Make sure to select the options to add VSCode to your PATH and install necessary dependencies during the installation process.
-
Install Extensions for C++ Development:
- Open VSCode and go to the Extensions view (click on the Extensions icon in the Activity Bar on the side of the window).
- Install the following extensions for C++ development:
- C/C++ by Microsoft (for IntelliSense, debugging, and code navigation)
- CMake Tools (if you plan to use CMake for your project)
- CodeLLDB (for debugging)
-
Configure VSCode for MSYS2:
- In VSCode, go to
File > Preferences > Settingsand search forC++. Make sure the compiler path is set to theg++executable from MSYS2. For example:"C_Cpp.default.compilerPath": "C:\\msys64\\mingw64\\bin\\g++.exe"
- In VSCode, go to
-
Download and Install MSYS2:
- Visit the MSYS2 website and download the appropriate version for your system (32-bit or 64-bit).
- Run the installer and follow the installation instructions. It’s recommended to install MSYS2 to the default directory.
-
Update MSYS2:
- Open the MSYS2 terminal (either MSYS2 MinGW 32-bit or MSYS2 MinGW 64-bit, depending on your system) and run the following commands to update the package database and core system packages:
pacman -Syu - If prompted to restart the terminal, close and reopen it, and then run the command again to ensure everything is up-to-date.
- Open the MSYS2 terminal (either MSYS2 MinGW 32-bit or MSYS2 MinGW 64-bit, depending on your system) and run the following commands to update the package database and core system packages:
-
Install the C++ Compiler:
- In the MSYS2 terminal, install the
gccpackage (which includes the C++ compiler) by running:pacman -S mingw-w64-x86_64-gcc
- In the MSYS2 terminal, install the
-
Install OpenCV:
- To install OpenCV and its dependencies, run the following command:
pacman -S mingw-w64-x86_64-opencv
- To install OpenCV and its dependencies, run the following command:
-
Install Qt (Optional for GUI Development):
- If you want to develop graphical applications using Qt, install Qt by running:
pacman -S mingw-w64-x86_64-qt5 - For the latest version of Qt (Qt6), run:
pacman -S mingw-w64-x86_64-qt6
- If you want to develop graphical applications using Qt, install Qt by running:
-
Open the Project Folder in VSCode:
- Open VSCode and navigate to your project folder by selecting
File > Open Folderand choosing the folder where you cloned your repository.
- Open VSCode and navigate to your project folder by selecting
-
Configure Build System:
- If you're using a simple
g++compiler setup, you can configure the build tasks by creating a.vscode/tasks.jsonfile. If you're using CMake, create aCMakeLists.txtfile and use the CMake extension in VSCode. - Set up the build task for compiling C++ code with OpenCV and Qt. For example, the command for compiling with
g++should include paths for OpenCV and Qt libraries (set up based on where they are installed).
- If you're using a simple
-
Configure Debugging:
- Set up debugging in VSCode by creating a
.vscode/launch.jsonfile. This will allow you to run and debug your program directly from VSCode. - Make sure the
miDebuggerPathpoints to the correctgdbexecutable from MSYS2, and ensure the compiler and libraries are correctly linked.
- Set up debugging in VSCode by creating a
-
Build the Project:
- In the VSCode terminal, navigate to your project directory if you haven’t already, and run the build task:
Ctrl+Shift+B - This will compile your project using the configured build system.
- In the VSCode terminal, navigate to your project directory if you haven’t already, and run the build task:
-
Run the Project:
- After building the project, you can run it directly from the VSCode terminal by executing:
./your_program_name
- After building the project, you can run it directly from the VSCode terminal by executing:
-
Compiler Not Found: If the compiler is not found, make sure that MSYS2 is installed correctly and that the
mingw64path is included in the system'sPATHenvironment variable. -
Missing Libraries or Headers: Ensure that OpenCV and Qt are installed and configured correctly in the
tasks.jsonorCMakeLists.txtfile. You may need to include additional paths to OpenCV and Qt libraries. -
VSCode Debugger Issues: Ensure that
gdbandg++are correctly set up in the MSYS2 environment. Check the paths in yourlaunch.jsonfile to make sure everything points to the right executables.
For additional resources, check out the following documentation: