macOS上编译assimp出错,提示ld: library not found for -lXXX

错误信息:

ld: library not found for -lminizip
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bshot] Error 1
make[1]: *** [CMakeFiles/bshot.dir/all] Error 2
make: *** [all] Error 2

前提:已安装minizip。可以使用brew install minizip安装
解决办法:
第一步:找到minizip库文件的位置
这里为/usr/local/Cellar/minizip/1.2.11/lib
第二步:添加路径
系统级:修改/etc/profile或者/etc/bashrc
用户级:修改~/.bashrc或者~/.bash_profile
将下面的复制粘贴到上述文件即可,注意修改路径

#添加到gcc头文件
export C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/local/Cellar/minizip/1.2.11/lib

#添加到g++头文件路径
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/Cellar/minizip/1.2.11/lib

#添加到动态库
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Cellar/minizip/1.2.11/lib

#添加到静态库
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/Cellar/minizip/1.2.11/lib

你可能感兴趣的:(macOS上编译assimp出错,提示ld: library not found for -lXXX)