UsingCB: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
(Imported from Redmine)
 
m (→‎Getting Started: <source> takes "lang" not "language"; eliminate syntax error. Use <syntaxhighlight> instead to avoid deprecation warning)
 
(2 intermediate revisions by 2 users not shown)
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 <syntaxhighlight lang="bash">cmake -G "CodeBlocks - Unix Makefiles" ..</syntaxhighlight><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].
Line 19: Line 19:
* Open it using Code::Blocks
* Open it using Code::Blocks


[[File:http://gnuradio.org/redmine/attachments/414/codeblocks_screenshot2.jpg|]]
[[File:codeblocks_screenshot2.jpg|codeblocks_screenshot2.jpg]]


== Using Code::Blocks ==
== Using Code::Blocks ==

Latest revision as of 09:04, 27 April 2023

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.