【发布时间】:2014-12-13 08:33:31
【问题描述】:
我正在尝试构建一个依赖于 SDL2 库的项目。我已经使用自制软件安装并链接了它:
> ls /usr/local/lib | grep SDL2
libSDL2-2.0.0.dylib
libSDL2.a
libSDL2.dylib
libSDL2_test.a
libSDL2main.a
我还将/usr/local/lib 添加到我的/etc/paths 和~/.bash_profile 中:
> cat /etc/paths
/usr/local/lib
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
但是,当我尝试构建项目时,我仍然收到此错误:
error: linking with `cc` failed: exit code: 1
note: cc '-m64' '-L' (...) '-lSDL2'
ld: library not found for -lSDL2
clang: error: linker command failed with exit code 1 (use -v to see invocation)
为什么会发生,我该如何解决?
【问题讨论】: