Mac OS:ld:找不到-lglfw的库

时间:2018-11-11 20:45:22

标签: macos glfw

建立项目时出现错误:

ld: library not found for -lglfw
clang: error: linker command failed with exit code 1 (use -v to see invocation)

但是我已经通过glfw安装了brew install 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)

1 个答案:

答案 0 :(得分:0)

看起来像将export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib添加到~/.bash_profile可以解决问题,但是我不确定这是否是无副作用的简单解决方案。