GRC C++ Generation: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
(Created page with "Note: This page is a work in progress. Starting from GNU Radio 3.8, GRC allows you to generate C++ code (not just Python) from your flowgraph. This feature was a SOCIS (ESA Summer of Code in Space) project in 2017. The C++ generation mode is significantly less stable and feature-rich than the default Python mode, since Python is a far more flexible language (and since GRC was created to generate Python code). About 50% of the in-tree blocks support C++ generation. The C...")
(No difference)

Revision as of 08:10, 14 August 2022

Note: This page is a work in progress.

Starting from GNU Radio 3.8, GRC allows you to generate C++ code (not just Python) from your flowgraph. This feature was a SOCIS (ESA Summer of Code in Space) project in 2017. The C++ generation mode is significantly less stable and feature-rich than the default Python mode, since Python is a far more flexible language (and since GRC was created to generate Python code). About 50% of the in-tree blocks support C++ generation. The C++ generation templates have to be written on a per-block basis, which is a considerable amount of work. This also means that it is a considerable amount of work to keep the C++ templates updated, which is why some blocks' templates may be outdated and produce errors. The good news is that these errors often have trivial fixes.

GRC generates C++ code by creating a new directory with three files:

  • top_block.cpp
  • top_block.hpp
  • CMakeLists.txt

All of these files are generated from templates, and changes in your flowgraph will be reflected in them. Additionally, GRC creates a build directory which you can call cmake and make from. Pressing the execute button in GRC will generate, compile and run your flowgraph.

https://wiki.gnuradio.org/index.php?title=Creating_c%2B%2B_OOT_with_gr-modtool

Adding C++ Templates to a Block

lorem ipsum

Troubleshooting

Generation Issues

Compilation Issues

Runtime Issues