Using Code::Blocks for editing GNU Radio modules¶
Code::Blocks is a widely used Integrated Development Environment (IDE) to develop C++ applications. This tutorial is supposed to give a howto get started using Code::Blocks with GNU Radio.
It is assumed you are using gr-modtool as described here and Code::Blocks is installed on your machine.
Getting Started¶After you created your project folder etc. with gr-modtools there are a few steps to do.
- Run cmake-gui and add a new entry called CMAKE_CODEBLOCKS_EXECUTABLE
Its value is a string with the path to your codeblocks executable.
- Finish this CMake preperations by generating the CMake files. (Click on Generate Button)
- Open the Shell of your choice. Change directory to your project folder and create a new subdirectory.
Maybe something like build-cb
- execute cmake -G "CodeBlocks - Unix Makefiles" ..
The -G option together with "CodeBlocks - Unix Makefiles" specifies the CMake Generator.
Possible Generators are described here.
- Now you can find a your-project.cbp file in the current directory.
- Open it using Code::Blocks
In the previous section it is described howto generate a Code::Blocks project with CMake. In this section there are some basic hints how to use Code::Blocks and thus have a quick start. In order to run a flowgraph use the your shell or GRC. Nevertheless there are some advantages if you Code::Blocks.
- You can compile/install your project and in case of an error the erroneous line will have automatic focus.
- Switch between .cc and .h file by hitting F11.
- There is a project explorer with all files.
- You may configure and use source code formatting.
- There is auto-completion available.
- Code folding
- Switch between methods by selecting them from a drop-down menu.