eclipse sfml 库问题
我拿出了一个使用 sfml 库用 C++ 编写的应用程序,但在 Eclipse 中设置该库时遇到了问题。我指定了包含路径、lib 路径并包含了要链接到的所有必需的 .so 库。该应用程序编译良好,但在运行时抱怨缺少库。为什么会发生这种情况?我不是已经在项目设置中包含了库的路径吗?我什至尝试将所有 .so 放在可执行目录中,但没有成功。
I pulled out an application that I wrote in C++ using the sfml library, but I'm having trouble setting up the library in Eclipse. I specified the include path, the lib path and included all the necessary .so libraries to link to. the application compiles fine but it complains at runtime about missing libraries. Why is this happening? Didn't I include the path to the libraries in the project settings already? I have even tried to place all the .so's in the executable directory with no luck.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可执行文件中仅存储共享库的名称。在程序启动时,动态链接器会在其搜索路径中搜索指定的库。您可以通过将搜索路径以冒号分隔的方式放置在环境变量 LD_LIBRARY_PATH 中或在 /etc/ld.so.conf 中指定它们来添加/指定搜索路径(至少如果您使用某些基于 UNIX 的操作系统)。在 Windows 上,搜索动态链接库 (DLL) 时将使用整个 PATH 环境变量。
要查看给定应用程序使用的共享库的路径,请运行
ldd applicationPath
。There is only the name of the shared lib stored in the executable. At program startup the dynamic linker then searches for the specified libs in its search paths. You can add/specify search paths by placing them colon separated in the environment variable LD_LIBRARY_PATH or by specifying them in /etc/ld.so.conf (at least if you use some unix based OS). On windows the whole PATH environment variable is used when searching for dynamic-link libraries (DLL).
To see the paths of shared libraries used by a given application run
ldd applicationPath
.