Skip to content

hkinke/gscppmsys2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started with C/C++ and MSYS2

Introduction

Msys2 offers the same tools as Linux to build software on Windows.

Installation

  • Download and install MSYS2 (page,installer). You can also use package managers like Chocolatey or Scoop to install MSYS2: Use this command to install with Chocolatey:

    choco install msys2

    Use this command to install with scoop:

    scoop install msys2
  • Lunch a bash shell from cmd

    C:\msys64\msys2_shell.cmd -defterm -here -no-start -ucrt64
  • Install git

    pacman -S git
  • Install gcc

    pacman -S mingw-w64-ucrt-x86_64-gcc
  • Install ninja

    pacman -S mingw-w64-ucrt-x86_64-ninja 
  • Install cmake

    pacman -S mingw-w64-ucrt-x86_64-cmake
  • Install Visual Studio Code.

  • Install C/C++ Extension Pack for Visual Studio Code. You can also install from commandline

    code --install-extension ms-vscode.cpptools-extension-pack
  • The next step is to clone starting repository

    git clone https://github.com/hkinke/gscppmsys2.git hello
  • Change the folder, remove .git folder, and start a new repository

    cd hello
    rm -rf .git
    git init
  • Change the replace gscppmsys2 in CMakeLists.txt with the name of your project by example hello.

    cmake_minimum_required(VERSION 3.18)
    
    
    project(hello)
    
    add_executable(main main.cpp)
  • From Visual Studio Code, choose the UCRT64 kit, configure, and build your project.

  • Lunch you application (you can use Visual Studio Code integrated terminal Ctrl+Shift+`)

    ./build/main

    which gives the output

    hello from Msys2
    

About

Getting started with C/C++ and MSYS2

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published