cmakelist里加了这2个库的依赖,libohimage.so,libimage\_receiver.so。报错信息如下:
ld.lld: error: undefined symbol: OH_ImageReceiverOptions_Create
>>> referenced by LavaHarmonyVideoDeviceTni.cpp:540 (/Users/xxx/Workspace/lava-stable/src/ohos/LavaHarmonyVideoDeviceTni.cpp:540)
>>> LavaHarmonyVideoDeviceTni.cpp.o:(lava::RtcHarmonyVideoCapturerTni::CreateImageReceiver(unsigned int, unsigned int)) in archive lite.out/lib/liblavad.a
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
A 'undefined symbol' error has occurred.
* Try the following:
> Troubleshoot the errors according to the following guidelines.
> More info: https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/ide-hvigor-faqs-0000001233028585-V5#section13911353105320
at OhosLogger.errorMessageExit (/Applications/DevEco-Studio.app/Contents/tools/hvigor/hvigor/src/base/log/hvigor-log.js:1:2844)
at OhosLogger._printErrorAndExit (/Applications/DevEco-Studio.app/Contents/tools/hvigor/hvigor-ohos-plugin/src/utils/log/ohos-logger.js:1:1931)
at ChildProcess.<anonymous> (/Applications/DevEco-Studio.app/Contents/tools/hvigor/hvigor-ohos-plugin/src/tasks/abstract-build-native.js:1:2162)
> hvigor ERROR: BUILD FAILED in 1 min 50 s 538 ms
在进行应用开发之前,需要打开native工程的src/main/cpp/CMakeLists.txt,在target\_link\_libraries依赖中添libohimage.so,libimage\_receiver.so,libnative\_image.so 以及日志依赖libhilog\_ndk.z.so。
参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/image-info-c-V5