Skip to content

redmach/gnu-win

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

gcc, g++ & gdb on Windows

Steps for downloading and installing the MinGW-w64 (Minimalist GNU for Windows) toolset, which includes gcc, g++, and gdb. This toolset is essential for developing C and C++ programs on Windows 10 or Windows 11 computers. The installation will be carried out using the msys2 Software Distribution and Building Platform.

Download MSYS2

  • MSYS2
  • Once you have downloaded and installed MSYS2 launch it.

Update MSYS2 UCRT64 Packages

  • Update the package db and base packages using pacman: pacman -Syu

Update MSYS2 MSYS

  • Update the package db and base packages using pacman: pacman -Su

Install gcc using MSYS2 MinGW 64-bit

  • Open MinGW 64-bit from the Windows menu. You can search for packages with name gcc using: pacman -Ss gcc
  • This will display all the packages for gcc. The one you are looking for (64-bit system) is: pacman -S mingw-w64-x86_64-gcc

Check to see if gcc is successfully installed

$ gcc --version
gcc.exe (Rev2, Built by MSYS2 project) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Check to see if g++ is successfully installed

$ g++ --version
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Install gdb Debugger

  • You can search for packages with name gdb using: pacman -Ss gdb
  • This will display all the packages for gdb. The one you are looking for (64-bit system) is:

pacman -S mingw-w64-x86_64-gdb

Check to see gdb version

gdb --version
GNU gdb (GDB) 13.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Set the Path environment variable once installation is complete

  • You won't be able to run any of your C and C++ programs from anywhere in your file system if you don't set the path environment variable.

  • Naviage to the location we installed MSYS2 and gcc.

  • It should be in the C:\msys64\mingw64\bin

  • From the Windows menu, search for Environment Variable and you should see "Edit the system environment variables" option.

  • Open that option and click the Environment Variables button and select the Path option in System variables;

  • Then click edit and select new and add the path C:\msys64\mingw64\bin and click OK.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors