Mac OS : ld: 找不到 -lglfw 的库
Mac OS : ld: library not found for -lglfw
构建我的项目时出现错误:
ld: library not found for -lglfw
clang: error: linker command failed with exit code 1 (use -v to see invocation)
但我已经通过 brew install glfw
安装了 glfw
brew list --versions | grep glfw
glfw 3.2.1
ls /usr/local/lib | grep glfw
libglfw.3.2.dylib
libglfw.3.dylib
libglfw.dylib
clang -v
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
MacOS : 10.14.1 (18B75)
看起来将 export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib
添加到 ~/.bash_profile
解决了问题,但我不确定它是否是没有副作用的优雅解决方案。
构建我的项目时出现错误:
ld: library not found for -lglfw
clang: error: linker command failed with exit code 1 (use -v to see invocation)
但我已经通过 brew install glfw
glfw
brew list --versions | grep glfw
glfw 3.2.1
ls /usr/local/lib | grep glfw
libglfw.3.2.dylib
libglfw.3.dylib
libglfw.dylib
clang -v
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
MacOS : 10.14.1 (18B75)
看起来将 export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib
添加到 ~/.bash_profile
解决了问题,但我不确定它是否是没有副作用的优雅解决方案。