Chris Riesbeck
Last updated: July 3, 2009
Code::Blocks is a free integrated development environment (IDE) for C and C++ on Windows, Linux and MacOS X. For the most part, it works quite well on these platforms, but some parts can be confusing. Hence, this Frequently Asked Questions file.
Does gcc --version
work in a Cygwin shell window?
Is Cygwin GCC selected as your default compiler in Settings | Compiler and Debugger?
Is Cygwin GCC selected as the compiler to use in the Project Build Options?
If the above are true, then the problem is probably that the gcc.exe
file in the Cygwin bin
directory is a Unix-style
shortcut that Code::Blocks doesn't know
how to use.
C:\Cygwin\bin
or wherever you installed Cygwin.gcc.exe
shortcut file and a 93K gcc-3.exe
application file,
gcc.exe
.
Now go back to Code::Blocks.
You should be good to go now.
Is the title of the project in Project Properties exactly
the same as the value assigned to PROJ in your Makefile
?
If not, your Makefile is making a .exe
with one name
and Code::Blocks is looking for a different name.
Fix your Makefile to agree with the title.
This means that none of the files in your project defines a main()
function. The most common cause of this is leaving out the .cpp
file
with main()
in your Makefile. Typically in this course that will be
your test file.
An application is a runnable program. Most applications are built from multiple source files. Code::Blocks and other IDEs keep track of the files and compiler settings need to build an application with a project file. In Code::Blocks, these files have the extension cbp.
Some IDEs, including Code::Blocks, let you collect projects together into a workspace, where you can easily switch between projects, define a common set of editor preferences, and so on. In Code::Blocks, these files have the extension workspace.
If you started the Code::Blocks application directly, and selected one of your projects in the Recent projects list, or you double-clicked a project file, then a new workspace is started with just that project.
The better way to start Code::Projects is by double-clicking your workspace file. Then you'll get the workspace you had before with all the projects in it. Don't forget to activate your project!
A number of things could be wrong. Check the following:
cppunit
directory
in usr/include
in your Cygwin directory.gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
.
Make sure your project is active in the workspace, if you have more than one. The title of the currently active project is shown in bold face in the workspace window. Any changes to Settings or Build options affect the currently active project only.
If some other project is active, you can easily end up changing settings and files for the wrong project.
To change the currently active project, right click (control-click in MacOS X) on the title of the desired project and select Activate project from the popup menu.
If multiple projects in a workspace confuse you, you can remove a project from the workspace.
Code::Blocks automatically puts all header (.h) files under the Header "folder" in the workspace window. Even though they're greyed out, they can be opened for editing by double-clicking on them.
Right-click (Windows and Linux) or control-click (MacOS X) on the project name in the workspace manager window, and select Close project from the popup menu.
This remove the project from the workspace. It does not delete it from your computer.
Use File | Open... and choose the project.cbp
file. The project will be opened and added to your workspace.
Do File | Save Everything to save this change.
In Windows, copy the entire project directory and give it a new name. Then follow the instructions for adding a project to the workspace.
Comments? Let me know!