Common problems and solutions

From CodeBlocks
Revision as of 04:50, 27 September 2011 by Alpha (Talk | contribs) (Deletion request - all content is now in the FAQ.)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

All content has been moved to the FAQ.

This page contains many of the common problems Code::Blocks users may run into and their solutions.

I cannot use the debugger


All the options in the debug menu are grayed out.


Code::Blocks can only use integrated debugging on an active project. Start a new project and add the file to it. Also see debugging with Code::Blocks.

Note: Code:Blocks only supports the GNU GDB and MSVC CDB debuggers.

Multi-targets library and executable ignore interdependence


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.


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. Also see inter-project dependencies.

Example: output\myLibrary\libdostuff.a

I want to report compile problem abc


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.


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, 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:
Paste build log here

Crash report:
If Code::Blocks crashed, paste the contents of codeblocks.RPT here.

I cannot build my project


All of the Build related options are grayed out.


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


The useful feature xyz I was told to use is nowhere to be found in Code::Blocks.


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


I am typing valid code, but it is all appearing as black text.


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


Project abc works everywhere except one computer where it gets stuck on step xyz.


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


I posted on the forums that Code::Blocks was not working, but no one could help me.


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.

Multiple undefined reference errors


Every time I build, Code::Blocks reports multiple undefined reference errors.


undefined reference to `WSACleanup@8
undefined reference to `WSACleanup@0


Most of the time it is because the required library is not linked with your project. Go to Project->Build options...->Linker settings (tab) and add the required library or libraries.

If the error includes a line number, it is likely that this is a problem with your code. Track down down your function declarations and implementations. Ensure they all match up, are spelled correctly, and have the correct scope resolution.