Skip to content

Instantly share code, notes, and snippets.

@hieplpvip
Created March 23, 2024 04:50
Show Gist options
  • Save hieplpvip/38d28f5563ac721ae040c37a00df228b to your computer and use it in GitHub Desktop.
Save hieplpvip/38d28f5563ac721ae040c37a00df228b to your computer and use it in GitHub Desktop.

Install MSYS and MinGW-w64

  • Download MSYS2 and install it.

Update MSYS2:

pacman -Syy
pacman -Syu

Install MinGW-w64

pacman -S mingw-w64-x86_64-toolchain

Install all members.

Install CodeBlocks

Configure debugger

  • In the top menu go to Settings and select Debugger...
  • In the left pane select GDB/CDB debugger
  • Click Create Config and enter a name (e.g. Debug_MINGW64)
  • Select this new entry on the left
  • Set the location to C:\msys64\mingw64\bin\gdb.exe
  • Uncheck Disable startup scripts (-nx) GDB only
  • Leave the other settings to their defaults (including Debugger type = GDB) and press OK

Configure compiler

  • In the top menu go to Settings and select Compiler...
  • Under Selected compiler choose GNU GCC Compiler
  • Click Copy and enter a name (e.g. MINGW64)
  • Under Selected compiler choose this new entry (should be at the bottom of the list)
  • Click the tab Toolchain executables
  • Under Compiler's installation directory set the location to C:\msys64\mingw64
  • Click the tab Program Files and set the following settings:
    • C compiler: x86_64-w64-mingw32-gcc.exe
    • C++ compiler: x86_64-w64-mingw32-g++.exe
    • Linker for dynamic libs: x86_64-w64-mingw32-g++.exe
    • Linker for static libs: x86_64-w64-mingw32-gcc-ar.exe
    • Debugger: Debug_MINGW64 (as created earlier)
    • Resource compiler: windres.exe
    • Make program: mingw32-make.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment