最近两天我试图在gnuradio中创建新块,但是当我尝试执行流程图时,我经常遇到错误:
GET /images
GET /image/<image_id>
POST /createImage
我认为我试图在我的项目中使用第三方库(opennn)存在一些问题。在主源文件(test_impl.cc)中我导入了opennn头文件。在功能 general_work 我调用函数:
AttributeError: 'module' object has no attribute 'test'
我的lib / CMakeLists.txt(在lib文件夹中,我有自动生成的gnuradio块源文件和带有opennn库的dirs):
int
test_impl::general_work (int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const float *in = (const float *) input_items[0];
float *out = (float *) output_items[0];
OpenNN::NeuralNetwork nn(8, 1, 1);
// Do <+signal processing+>
// Tell runtime system how many input items we consumed on
// each input stream.
consume_each (noutput_items);
// Tell runtime system how many output items we produced.
return noutput_items;
}
我尝试添加以下代码:
########################################################################
# Setup library
########################################################################
include(GrPlatform) #define LIB_SUFFIX
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIRS})
list(APPEND tutorial3_sources
test_impl.cc
)
set(tutorial3_sources "${tutorial3_sources}" PARENT_SCOPE)
if(NOT tutorial3_sources)
MESSAGE(STATUS "No C++ sources... skipping lib/")
return()
endif(NOT tutorial3_sources)
add_library(gnuradio-tutorial3 SHARED ${tutorial3_sources})
target_link_libraries(gnuradio-tutorial3 ${Boost_LIBRARIES} ${GNURADIO_ALL_LIBRARIES})
set_target_properties(gnuradio-tutorial3 PROPERTIES DEFINE_SYMBOL "gnuradio_tutorial3_EXPORTS")
if(APPLE)
set_target_properties(gnuradio-tutorial3 PROPERTIES
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
)
endif(APPLE)
########################################################################
# Install built library files
########################################################################
include(GrMiscUtils)
GR_LIBRARY_FOO(gnuradio-tutorial3 RUNTIME_COMPONENT "tutorial3_runtime" DEVEL_COMPONENT "tutorial3_devel")
########################################################################
# Build and register unit test
########################################################################
include(GrTest)
include_directories(${CPPUNIT_INCLUDE_DIRS})
list(APPEND test_tutorial3_sources
${CMAKE_CURRENT_SOURCE_DIR}/test_tutorial3.cc
${CMAKE_CURRENT_SOURCE_DIR}/qa_tutorial3.cc
)
add_executable(test-tutorial3 ${test_tutorial3_sources})
target_link_libraries(
test-tutorial3
${GNURADIO_RUNTIME_LIBRARIES}
${Boost_LIBRARIES}
${CPPUNIT_LIBRARIES}
gnuradio-tutorial3
)
GR_ADD_TEST(test_tutorial3 test-tutorial3)
########################################################################
# Print summary
########################################################################
message(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "Building for version: ${VERSION} / ${LIBVER}")
说实话,我已尝试在很多方面修改此CMake文件,但我总是收到此错误。
答案 0 :(得分:0)
您的问题为我提供了解决问题的线索,我认为这与此处描述的相同,但我不确定。我的解决方案是将缺少的外部库 yaml-cpp
添加到文件 target_link_libraries
中的 lib/CMakeLists.txt
指令,用于我的 GnuRadio 模块。
target_link_libraries(gnuradio-AUK gnuradio::gnuradio-runtime yaml-cpp)
我添加了一些 C++ YAML 代码来解析配置文件。它编译得很好,但给出了难以理解的消息:
AttributeError: module ... has no attribute ...
现在都修复了。非常感谢提供线索。