Skip to content Skip to sidebar Skip to footer

Gnuradio `ImportError Undefined Symbol`

I'm new to GNU Radio and python. I'm trying to write a correlation block, somewhere in my code I use fft filter: gr::filter::kernel::fft_filter_ccc *d_filter; d_filter = new gr::

Solution 1:

This often happens when you have declared a method at the header file, but you do not implement it. For example a destructor or something else.

To find out which method it is you should demangle the undefined symbol _ZN2gr6filter6kernel14fft_filter_cccC1EiRKSt6vectorISt7complexIfESaIS5_EEi.

This can be done using the c++filt tool. For example,

c++filt \ _ZN2gr6filter6kernel14fft_filter_cccC1EiRKSt6vectorISt7complexIfESaIS5_EEi

In your case this symbol is an existing symbol of the GNU Radio, located in the gr-filter module. Each GNU Radio module creates a library, so in order to resolve the undefined symbol issue you have to link against the required library. To accomplish this you have to do the following steps:

At the CMakeLists.txt file of your module, specify on which components of GNU Radio you depend. In your case the FILTER component.

set(GR_REQUIRED_COMPONENTS RUNTIME FILTER)
find_package(Gnuradio "3.7.0" REQUIRED)

Further dependencies can be inserted, eg:

set(GR_REQUIRED_COMPONENTS RUNTIME FILTER DIGITAL)

After that you can use the ${GNURADIO_ALL_INCLUDE_DIRS} and ${GNURADIO_ALL_LIBRARIES} auto generated variables to properly include the proper header files and link against the appropriate libraries. E.g:

include_directories(
    ${CMAKE_SOURCE_DIR}/lib
    ${CMAKE_SOURCE_DIR}/include
    ${CMAKE_BINARY_DIR}/lib
    ${CMAKE_BINARY_DIR}/include
    ${Boost_INCLUDE_DIRS}
    ${CPPUNIT_INCLUDE_DIRS}
    ${GNURADIO_RUNTIME_INCLUDE_DIRS}
    ${GNURADIO_ALL_INCLUDE_DIRS}
)

target_link_libraries(gnuradio-howto
                      ${Boost_LIBRARIES}
                      ${GNURADIO_RUNTIME_LIBRARIES}
                      ${GNURADIO_ALL_LIBRARIES})

For more info refer here.


Post a Comment for "Gnuradio `ImportError Undefined Symbol`"