Common problems and solutions
This page contains many of the common problems Code::Blocks users may run into and their solutions.
I cannot use the debugger
Problem
All the options in the debug menu are grayed out.
Solution
Code::Blocks can only use integrated debugging on an active project. Start a new project and add the file to it.
Note: Code:Blocks only supports the GNU GDB and MSVC CDB debuggers.
Multi-targets library and executable ignore interdependence
Problem
My project contains a two targets: static/dynamic library and an executable that links to it. Code::Blocks does not
- build the library first.
- force relink if the library is changed.
Solution
Open Project->Properties...->Build targets (tab) and select the executable. Click Dependencies... and add the name of the library (including its relative path) to External dependency files.
Example: output\myLibrary\libdostuff.a
I want to report compile problem abc
Problem
Every time I build my project xyz, compile problem abc happens, and I want to report it on the forums as a Code::Blocks bug.
Solution
Try building the project from command line. If the same error comes up, it is a problem with either the source file, the compiler, or the compiler setup. If this is the case, you are unlikely to receive support for it on the Code::Blocks forums, however, How do I troubleshoot an compiler problem? may help.
If it works fine building from command line, it is either a problem with your project or Code::Blocks' setup, or possibly an actual bug. When posting this problem, include the name of your compiler, operating system, Code::Blocks version, compiler log (go to Settings->Compiler and debugger...->Build options (tab) and check Save build log and Always output the full command line), and, if it caused Code::Blocks to crash, the codeblocks.RPT file (located in the Code::Blocks installation directory).
Template: Paste the following template into your post, editing the relevant sections.
OS = MyOperatingSystem CB Version = Code::BlocksVersionNumber Compiler = CompilerName CompilerVersionNumber Description of relevant events. Build log: [code] Paste build log here [/code] Crash report: [code] If Code::Blocks crashed, paste the contents of codeblocks.RPT here. [/code]
I cannot build my project
Problem
All of the Build related options are grayed out.
Solution
Code::Blocks checks the file extension for individual files before allowing them to be compiled. Save your file with the correct file extension (*.c or *.cpp).
More often it is useful to create a project so that Code::Blocks can manage the entire build
Code::Blocks option xyz is missing
Problem
The useful feature xyz I was told to use is nowhere to be found in Code::Blocks.
Solution
Many features of Code::Blocks are implemented by means of plugins. First open Plugins->Manage plugins... and ensure that the one you are trying to use is not disabled. If plugin xyz is not in the list, it is possible that you removed/disabled it on installation. To acquire the plugin, reinstall Code::Blocks (double checking that the desired plugin is included).
Syntax highlighting is broken
Problem
I am typing valid code, but it is all appearing as black text.
Solution
Code::Blocks cannot know how to highlight your code unless it knows what lexer to use. This is normally automatically determined by the file extension, so it is important to save the file and name it correctly (*.c or *.cpp for C and C++ code). It is also possible to activate syntax highlighting on a temporary basis. Open Edit->Highlight mode and select the language the current file is using.
Untraceable reoccurring error
Problem
Project abc works everywhere except one computer where it gets stuck on step xyz.
Solution
Some parts of Code::Blocks or the back-end compiler may not support non ASCII characters (such as é) or possibly spaces. Try moving the project on the affected computer to a directory that contains neither of these in its path.
Help, no one can solve my problem
Problem
I posted on the forums that Code::Blocks was not working, but no one could help me.
Solution
There is a distinct lack of crystal balls and divining mirrors here, so you may want to post some information. Using this template in your problem description would be a great help.