Error compiling assimp on macOS, prompt ld: library not found for -lXXX

Error message:

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

Prerequisite: minizip has been installed. You can use the brew install minizipinstallation
Solution:
Step 1: Find the location of the minizip library file.
Here is /usr/local/Cellar/minizip/1.2.11/lib
Step 2: Add path
System level: Modify /etc/profileor /etc/bashrc
User level: Modify ~/.bashrcor ~/.bash_profile
just copy and paste the following to the above file. Pay attention to modify the path

#添加到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

Guess you like

Origin blog.csdn.net/qq_45465526/article/details/106737205