Return to FAQ.
Q: How do I get Code Completion to work?
A: Did you check how code completion is configured? See "Settings/Editor", click on "Code-completion and symbols browser" in the left column and check the Code completion and C/C++ parser tabs.
From the 2006/11/30 nightly build, you can also add, in the project properties, directories to be searched when locating a file to parse .Right click on the project, click on Properties and select the C/C++ parser options.
They're mostly useful when you don't add compiler search dirs in build options but use backticked expressions (e.g. `freetype-config --cflags`). In this case, the parser is not aware of where the source files are located. So, by manually adding the directory in the parser's search dirs you're actually helping the parser find the files.
Of course, backticked expressions are not the only reason these parser search dirs are useful. As another example, I have a set of projects in a workspace. To minimize maintenance overhead, I'm using build scripts to configure these projects. Now, although build scripts are an awesome feature, the C/C++ parser faces the same problem: it doesn't know where to search for files. The parser search directories come to the rescue again.
Q: Where does C::B's configuration file store? How do I make Code::Blocks portable?
Just the main configuration
- run / configure C::B as usual
Note: Code::Blocks will create a default.conf file that usually is placed into: "C:\Documents and Settings\[your_user_name]\Application Data\codeblocks" (or %APPDATA%) on Windows or your usual home folder ("~/") under Linux.
- place this default.conf file into the directory where the codeblocks binary is
- remove the default.conf file from %APPDATA% / home folder respectively
- just run C::B from within the C::B path and/or via script / link...
Note: Don't forget to remove all bad hacks you might have done previously that modify %USERPROFILE% and/or %APPDATA% on Windows.
Note: If C::B does not find default.conf (its config) within the %APPDATA% / home folder it looks within the C::B directory (the one where the C::B executable is) next. If there is no config file, too it will be created in the %APPDATA% / home folder. So just make sure you are doing the right thing and C::B is portable just fine.
BTW: This does probably not apply for any other config file(s) where not C::B is the maintainer but e.g. plugins. The main config file just works like that.
If you would like to use different configuration file for different purpose, see: Personalities.
Complete mobile with compiler and plugins
An alternative way to make Code::Blocks completely portable can be achieved by following these steps:
- Set up a SVN compiled version (Linux)/a nightly (Windows) in the portable directory of your choice
- WINDOWS ONLY: Move your compiler (likely Mingw) into the directory where the nightly Code::Blocks you just set up resides so that you get codeblocks\mingw
- Linux systems will have a compiler anyway so that step is not necessary for Linux
- Next you will need a script to change your home data variable and launch Code::Blocks
- Create a new file in your new Code::Blocks directory (launcher.sh for Linux, launcher.bat for Windows) and open it with an editor
- Paste the following script in there and save it:
#!/bin/bash HOME="`pwd`/settings" mkdir -p "$HOME" ./codeblocks $*
set APPDATA=%~dp0settings mkdir %APPDATA% START /D"%~dp0" codeblocks.exe %*
- LINUX ONLY: Make the file you just created executable: chmod +x laucnher.sh
- You can now launch this by either typing ./launcher.sh (Linux) or by double-clicking it in Windows
A portable Code::Blocks Launcher for Windows [/index.php?action=profile;u=2439 Biplab], an active developer of CB, has released the portable CB loader v0.1.1 in his Blog, and later, [/index.php?action=profile;u=4689 codeur] has made many improvements, and Now, CBlauncher is a part of C::B source code, its code was adopted in the C::B's SVN repository, see [/index.php/topic,10360.msg98052.html#msg98052 Re: Portable Code::Blocks] for more details.
A binary version of CBLauncher can be downloaded from http://cblauncher.codecutter.org/CbLauncher_1.0.1.zip. The CbLauncher 1.0.1 source code package can be download from http://CbLauncher.codecutter.org/CbLauncher_1.0.1_src.zip, then to build it and run Code::Blocks portable. Or you can check out the C::B's SVN repository, it was located under: http://svn.berlios.de/svnroot/repos/codeblocks/trunk/src/tools/CBLauncher Then, you can build it by opening the project file http://svn.berlios.de/svnroot/repos/codeblocks/trunk/src/tools/CBLauncher/CbLauncher.cbp Steps to use Cblauncher:
- Download a nightly build with revision > 5334.
- Extract them to a folder.
- Extract CbLauncher.exe to same folder where codeblocks.exe file is present. After extraction, CbLauncher.exe and codeblocks.exe should be in same folder.
- Now double click on on CbLauncher.exe file to run Code::Blocks in a portable manner.
Also, see [/index.php/topic,10360.0.html Portable Code::Blocks] for more details.
Q: Code::Blocks option xyz is missing?
A: 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 or rebuild from source (double checking that the desired plugin is included).
Q: How do I change the default location of the output terminal?
A: Because the terminal is a separate program that has been executed, it is the window manager of the operating system that places it (not Code::Blocks).
To change this in Windows:
- Click on the top left corner of a Command Prompt window (the "C:\" icon).
- From the drop-down menu select Defaults.
- On the Layouts tab uncheck "Let system position window".
- Enter your desired location in the relevant boxes.
To change this in Ubuntu, try these instructions (they may not be applicable to newer versions).
Return to FAQ.