UsingCB: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
m (Corrected a formatting issue with a cmake command (it had strikeouts embedded rather than a -).)
Line 13: Line 13:
* Open the Shell of your choice. Change directory to your project folder and create a new subdirectory.<br />
* Open the Shell of your choice. Change directory to your project folder and create a new subdirectory.<br />
Maybe something like ''build-cb''
Maybe something like ''build-cb''
* execute ''cmake <s>G &quot;CodeBlocks</s> Unix Makefiles&quot; ..''<br />
* execute <source language="bash">cmake -G "CodeBlocks - Unix Makefiles" ..</source><br />
The ''-G'' option together with ''&quot;CodeBlocks - Unix Makefiles&quot;'' specifies the CMake Generator.<br />
The ''-G'' option together with ''&quot;CodeBlocks - Unix Makefiles&quot;'' specifies the CMake Generator.<br />
Possible Generators are described [http://cmake.org/cmake/help/v2.8.8/cmake.html#section_Generators here].
Possible Generators are described [http://cmake.org/cmake/help/v2.8.8/cmake.html#section_Generators here].

Revision as of 22:22, 21 July 2018

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

codeblocks_screenshot2.jpg

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.
  • etc.