对于所有遇到类似问题的人,请运行以下命令:
LD_LIBRARY_PATH=/usr/local/lib64/:$LD_LIBRARY_PATHexport LD_LIBRARY_PATH
当您编译并安装GCC时,确实会将库放在此处,仅此而已。如常见问题解答所述(http://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.how_to_set_paths),您需要添加它。
我假设“如何确保可以找到动态链接的库?”的意思是“如何确保始终找到该动态链接的库”,而不是“不会被找到,您需要这样做”
对于那些不想设置前缀的人,它是/ usr / local / lib64
如果您阅读make输出,则可以在安装gcc时简短地找到此内容:
Libraries have been installed in: /usr/local/lib/../lib32If you ever happen to want to link against installed librariesin a given directory, LIBDIR, you must either use libtool, andspecify the full pathname of the library, or use the `-LLIBDIR'flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf'See any operating system documentation about shared libraries formore information, such as the ld(1) and ld.so(8) manual pages.
太简单了!另外,“如果您碰巧想要链接到已安装的库”,是认真的吗?
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)