大概是在链接SimpleViewer的时候
/usr/bin/ld: /home/moresweet/Downloads/OpenNI_2.3.0.81_202110281040_ff72b9bf_release_linux/samples/samples/SimpleViewer/../ThirdParty/OpenCV420/Linux/lib/libopencv_highgui.so: .dynsym local symbol at index 2 (>= sh_info of 2) /usr/bin/ld: /home/moresweet/Downloads/OpenNI_2.3.0.81_202110281040_ff72b9bf_release_linux/samples/samples/SimpleViewer/../ThirdParty/OpenCV420/Linux/lib/libopencv_highgui.so: .dynsym local symbol at index 3 (>= sh_info of 2) /usr/bin/ld: /home/moresweet/Downloads/OpenNI_2.3.0.81_202110281040_ff72b9bf_release_linux/samples/samples/SimpleViewer/../ThirdParty/OpenCV420/Linux/lib/libopencv_highgui.so: .dynsym local symbol at index 4 (>= sh_info of 2) /usr/bin/ld: /home/moresweet/Downloads/OpenNI_2.3.0.81_202110281040_ff72b9bf_release_linux/samples/samples/SimpleViewer/../ThirdParty/OpenCV420/Linux/lib/libopencv_imgcodecs.so: .dynsym local symbol at index 2 (>= sh_info of 2) /usr/bin/ld: /home/moresweet/Downloads/OpenNI_2.3.0.81_202110281040_ff72b9bf_release_linux/samples/samples/SimpleViewer/../ThirdParty/OpenCV420/Linux/lib/libopencv_imgcodecs.so: .dynsym local symbol at index 3 (>= sh_info of 2) /usr/bin/ld: /home/moresweet/Downloads/OpenNI_2.3.0.81_202110281040_ff72b9bf_release_linux/samples/samples/SimpleViewer/../ThirdParty/OpenCV420/Linux/lib/libopencv_imgcodecs.so: .dynsym local symbol at index 4 (>= sh_info of 2)
Ubuntu20.04,gcc也为9.x,opencv为4.5.5,故怀疑官方链接的库并不适配我的本地环境
以下是官方自带的链接库
编辑CMakeLists(/home/[YOUR USRENAME]/Downloads/OpenNI_2.3.0.81_202110281040_ff72b9bf_release_linux/samples/samples/SimpleViewer),更改为自己的opencv库所在的目录
重新编译,链接成功