of type std::bad_cast: std::bad_cast
我这里的情况:
我有两个so A 和B,调用程序c
B调用a ,b的cmakelist里面要加A和A的头文件:
头文件:
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../android/${MNN_DIR}/include)
库:
add_library( A SHARED IMPORTED )
set_target_properties(
A
PROPERTIES IMPORTED_LOCATION
${CMAKE_CURRENT_LIST_DIR}/../android/${MNN_DIR}/libA.so
)
c调用的时候,要加a和b:
add_library( A SHARED IMPORTED )
set_target_properties(
A
PROPERTIES IMPORTED_LOCATION
${CMAKE_CURRENT_LIST_DIR}/../lib/no_config/${ANDROID_ABI}/libA.so
)
可执行配置要加A和B和头文件和库:
头文件:
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../android/${MNN_DIR}/include)
库引用:
add_executable(bar_test ${SRC_CODE})
target_link_libraries(test
MNN
#MNN_GL
B
A
${android_opencv}/sdk/native/libs/${ANDROID_ABI}/libopencv_java3.so
-llog
-lz
-ljnigraphics
)
我只引用了B,以为不用引用A呢,结果就报错了。