I faced the same problem. I have fixed out by going to Setting -> Compiler -> Global Compiler Settings -> Toolchain Execuatables (tab). There, click on Program Files and then rename C compiler to gcc.exe and C++ compiler to g++.exe.

Answer from SilverSurfer on Stack Overflow
🌐
Code::Blocks
wiki.codeblocks.org › index.php › Installing_a_supported_compiler
Installing a supported compiler - Code::Blocks
In other words, it is not known yet whether these compilers still work with Code::Blocks. ... The official MinGW website is now here. A MinGW-bundled version of the latest Code::Blocks release is available from the Code::Blocks download page. If you install this version, the GCC compiler will ...
🌐
Code::Blocks
codeblocks.org › downloads › binaries
Binary releases - Code::Blocks
August 24, 2025 - NOTE: The codeblocks-25.03mingw-setup.exe file includes additionally the GCC/G++/GFortran/Clang compiler and GDB debugger from WinLibs project (version 14.2.0, 32/64 bit).
🌐
Code::Blocks
forums.codeblocks.org › index.php
GNU GCC compiler for C/C++
The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here
🌐
Quora
quora.com › How-do-I-download-and-install-a-GNU-GCC-compiler-in-Code-Blocks
How to download and install a GNU GCC compiler in Code::Blocks - Quora
Answer: You can get a Code::Blocks install that comes with a version of GCC bundled with it. I would however recommend not installing that. You could install GCC manually via the download section on their website. But again I would not recommend this. I would personally, and this is what I do -...
🌐
Guru99
guru99.com › home › c programming › how to download and install gcc compiler in c for windows pc
How to Download and Install GCC Compiler in C for Windows PC
August 8, 2024 - Choose the installer with GCC Compiler, e.g., codeblocks-17.12mingw-setup.exe which includes MinGW’s GNU GCC compiler download and GNU GDB debugger with Code::Blocks source files.
🌐
Reddit
reddit.com › r/cpp_questions › how can i setup the gnu/gcc compiler in the windows environment?
r/cpp_questions on Reddit: How can I setup the GNU/GCC compiler in the Windows environment?
October 3, 2019 -

I apologize for the long post in advanced-- I'm just trying to describe what I've already tried as best as possible in order to better troubleshoot the issue.

I am in an introductory C++ class and we have been using the school computers with all the environments already pre-configured for us. The teacher told us that we can simply download CodeBlocks or XCode for Win/macOS and use the GNU/GCC compiler without any problems. He also stated multiple times that for our curriculum, we would require this compiler specifically instead of something like MSVC, since it better follows traditional C++ standards and allows teachers and students to build any source code on multiple machines.

I installed Codeblocks a little while ago and I'm trying to get my source code running on my home computer now. To my surprise, Codeblocks could not automatically find the compiler on my system after following the default installation (full features). When doing a custom Windows Explorer search for the compiler executable on my entire hard drive, it could not find any trace of the file located on my computer either. Our teacher said that this compiler should be included in the Codeblocks installation, but it looks to me as though didn't install it whatsoever. I also checked to ensure I was downloading the latest version, re-ran the installation as admin, but there was still no trace of the compiler anywhere to be found.

After doing some investigating online, I learned that the GNU compiler is actually not a Windows compiler at all but was mainly developed for Unix based systems first. The compiler that Codeblocks expects is actually "mingw" which is apparently a port of the free GCC compiler from these other platforms.

I found the "mingw installation manager" binary package online, installed it on my system, then proceeded to download and install all the packages under the mingw repositories 'basic setup'. After applying the changes, it installed mingw to a root folder on my C:\\ drive where Codeblocks first expected it, which then allowed me to build/run the basic example script "Hello World" within the IDE. All seemed well now, except there were still some other problems happening...

While trying to build my script I'd previously been working on, one of the namespaces from the <thread> library threw a compiler error. This error did not show up while working on the school's computers, which leads me to believe that I might be missing some additional packages of some sort. If this is the case, then this is going to cause a lot of trouble down the road when trying to build source code that could be using correct syntax but missing some other resource.

To ensure that I am not just crazy, please see this small snip-it to verify the source code:

#include <iostream>
#include <thread>
#include <string>
#include <chrono>

using namespace std;
using namespace std::chrono;
using namespace std::this_thread;

// error: compiler complains that "this_thread" is not a namespace-name

In my global compiler settings within Codeblocks, I have also checked the following box:

Have g++ follow the C++14 ISO C++ language standard [-std=c++14]

Why is the compiler not finding the std::this_thread; namespace? Am I missing a resource? How can I setup up my computer with everything I need using the mingw GNU/GCC compiler?

PS: I am trying to use std::this_thread::sleep_for() from the <thread> library in order pause the program and allow the user to see a displayed message before it is cleared from the standard output in the console.

🌐
NTU Singapore
www3.ntu.edu.sg › home › ehchua › programming › howto › CodeBlocks_HowTo.html
CodeBlocks for C/C++ Programming
Click "Download the binary release". Select your operating platform (e.g., Windows 2000/XP/Vista/7). Download the installer with GCC Compiler, e.g., codeblocks-13.12mingw-setup.exe (98 MB) (which includes MinGW's GNU GCC compiler and GNU GDB debugger).
Find elsewhere
🌐
SourceForge
sourceforge.net › projects › gcc-win64
gcc-win64 download | SourceForge.net
gnu gcc compiler for codeblocks windows 10 · Related Business Categories · Build Automation · Application Development · ✕ · Thanks for helping keep SourceForge clean.
Top answer
1 of 10
111

I'm guessing you've installed Code::Blocks but not installed or set up GCC yet. I'm assuming you're on Windows, based on your comments about Visual Studio; if you're on a different platform, the steps for setting up GCC should be similar but not identical.

First you'll need to download GCC. There are lots and lots of different builds; personally, I use the 64-bit build of TDM-GCC. The setup for this might be a bit more complex than you'd care for, so you can go for the 32-bit version or just grab a preconfigured Code::Blocks/TDM-GCC setup here.

Once your setup is done, go ahead and launch Code::Blocks. You don't need to create a project or write any code yet; we're just here to set stuff up or double-check your setup, depending on how you opted to install GCC.

Go into the Settings menu, then select Global compiler settings in the sidebar, and select the Toolchain executables tab. Make sure the Compiler's installation directory textbox matches the folder you installed GCC into. For me, this is C:\TDM-GCC-64. Your path will vary, and this is completely fine; just make sure the path in the textbox is the same as the path you installed to. Pay careful attention to the warning note Code::Blocks shows: this folder must have a bin subfolder which will contain all the relevant GCC executables. If you look into the folder the textbox shows and there isn't a bin subfolder there, you probably have the wrong installation folder specified.

Now, in that same Toolchain executables screen, go through the individual Program Files boxes one by one and verify that the filenames shown in each are correct. You'll want some variation of the following:

  • C compiler: gcc.exe (mine shows x86_64-w64-mingw32-gcc.exe)
  • C++ compiler: g++.exe (mine shows x86_64-w64-mingw32-g++.exe)
  • Linker for dynamic libs: g++.exe (mine shows x86_64-w64-mingw32-g++.exe)
  • Linker for static libs: gcc-ar.exe (mine shows x86_64-w64-mingw32-gcc-ar.exe)
  • Debugger: GDB/CDB debugger: Default
  • Resource compiler: windres.exe (mine shows windres.exe)
  • Make program: make.exe (mine shows mingw32-make.exe)

Again, note that all of these files are in the bin subfolder of the folder shown in the Compiler installation folder box - if you can't find these files, you probably have the wrong folder specified. It's okay if the filenames aren't a perfect match, though; different GCC builds might have differently prefixed filenames, as you can see from my setup.

Once you're done with all that, go ahead and click OK. You can restart Code::Blocks if you'd like, just to confirm the changes will stick even if there's a crash (I've had occasional glitches where Code::Blocks will crash and forget any settings changed since the last launch).

Now, you should be all set. Go ahead and try your little section of code again. You'll want int main(void) to be int main(), but everything else looks good. Try building and running it and see what happens. It should run successfully.

2 of 10
42

Just open your setting->compiler and click on the reset defaults and it will start work.

🌐
Universidad de Cantabria
personales.unican.es › corcuerp › ProgCpp › install_codeblocks.html
How To Install Codeblocks
It supports many compilers, such as GNU GCC (MinGW and Cygwin) and MS Visual C++. It supports interactive debugging (via GNU GDB or MS CDB). CodeBlocks is surprisingly versatile, and is considered by many, much better than the Visual Studio suite. The mother site of CodeBlocks is www.codeblocks.org.
🌐
Code::Blocks
forums.codeblocks.org › index.php
The compiler's setup (GNU GCC Compiler) is invalid, but i can't find a cpu match
The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .
🌐
Technobyte
technobyte.org › install-code-blocks-gcc-compiler-first-c-program-windows-10
Install CodeBlocks, GCC compiler & run your first C program - Windows 10
March 2, 2020 - A guide to properly installing the latest version of CodeBlocks with the GCC compiler and testing it with your first C program.
🌐
Code::Blocks
forums.codeblocks.org › index.php
How to install the GNU ARM compiler toolchain for codeblocks?
The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .
🌐
YouTube
youtube.com › watch
How to Install CodeBlocks IDE on Windows 11 with Compilers ( GCC , G++) - YouTube
In this video I am going to show How to Install Codeblocks IDE on Windows 11 with Compilers. We will see how to install MinGw compiler with code blocks. ( GC...
Published   December 2, 2021
🌐
GNU
gcc.gnu.org
GCC, the GNU Compiler Collection - GNU Project
The GNU Compiler Collection includes front ends for C, C++, Objective-C, Objective-C++, Fortran, Ada, Go, D, Modula-2, COBOL, Rust, and Algol 68 as well as libraries for these languages (libstdc++,...). GCC was originally written as the compiler for the GNU operating system.
🌐
Lanecc
media.lanecc.edu › users › birdb › CS133G › CodeBlocks Troubleshooting.html
Untitled 1
If you already have a compiler ... (GCC), MinGW (Minimal GCC for Windows), etc. The setup file for just the Code::Blocks IDE by itself is: codeblocks-10.05-setup.exe....
🌐
Solarian Programmer
solarianprogrammer.com › 2019 › 11 › 16 › install-codeblocks-gcc-windows-build-c-cpp-fortran-programs
Install Code::Blocks and GCC 9 on Windows - Build C, C++ and Fortran programs | Solarian Programmer
... From the Downloads section of Code::Blocks select Download the binary release. On this page, select the version of the installer that doesn’t contain mingw in his name, typically this is the first option: Start the installation process and accept all defaults.
🌐
Code::Blocks
code-blocks.en.uptodown.com › windows › development › c/c++ › code::blocks
Code::Blocks for Windows - Download it from Uptodown for free
April 11, 2025 - Download Code::Blocks for Windows for free. An open-source IDE for C, C++ and Fortran. Code::Blocks is an integrated development environment that allows...