使用 cmake 和 opencv 未定义对符号 'gzclose' 的引用

Undefined reference to symbol 'gzclose' with cmake and opencv

我尝试构建项目,doppia,但出现链接错误。我想这是一个链接器错误,但我花了很多时间并没有找到有效的答案。

我之前试过,没有报错。但是我有关于 CUDA 的其他错误,所以我重新安装了 opencv。之后,出现此链接错误。

因此,我认为这是与opencv相关的问题,例如路径错误等

命令:

cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo . && make

路径.bashrc

LD_LIBRARY_PATH=/home/username/Documents/Python/imra/code/opencv-2.4.11/release/lib:/home/username/Documents/Python/imra/code/opencv-2.4.11/release/3rdparty/lib/:$LD_LIBRARY_PATH

export LD_LIBRARY_PATH
PKG_CONFIG=$PKG_CONFIG_PATH:/home/matterd/Documents/Python/imra/code/opencv-2.4.11/release/unix-install/
export PKG_CONFIG_PATH

输出

/usr/bin/ld: /home/matterd/Documents/Python/imra/code/opencv-2.4.11/release/installed/lib/libopencv_core.a(persistence.cpp.o): undefined reference to symbol 'gzclose' /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libz.so: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[2]: * [ground_estimation] error 1 make1: * [CMakeFiles/ground_estimation.dir/all

]错误2 make: *** [所有] 错误 2

一些信息:

我找到了解决方案。该错误是由 link 文件的顺序引起的。

Compilation problems with ZLIB