运行下面的命令;
$ ll /usr/lib/libfastcommon.so
-rwxr-xr-x 1 root wheel 250604 11 27 21:35 /usr/lib/libfastcommon.so*
$ ll /usr/lib64/libfastcommon.so
-rwxr-xr-x 1 root wheel 250604 11 27 21:35 /usr/lib64/libfastcommon.so*
$ gcc -L/usr/lib64 -lfastcommon
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
$ gcc -L/usr/lib -lfastcommon
ld: library not found for -lfastcommon
clang: error: linker command failed with exit code 1 (use -v to see invocation)
问题是,为什么明明存在 /usr/lib/libfastcommon.so 文件, gcc -L/usr/lib -lfastcommon 确报错??
环境:
$ uname -a
Darwin gfdeMacBook-Air.local 15.0.0 Darwin Kernel Version 15.0.0: Wed Aug 26 16:57:32 PDT 2015; root:xnu-3247.1.106~1/RELEASE_X86_64 x86_64
$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.