如何具体找到 dll :: GLUT 的依赖项
我已经学习opengl大约4-5个月了。 我准备停止使用 glut(一个帮助器库,它混淆了 opengl 编程的许多困难/繁琐的方面)
问题是我觉得我已经删除了对 glut.h 的所有引用以及所有函数调用在 glut 中,但是当我运行我的应用程序时,它仍然尝试链接到 glut32.dll。
一般来说,这样我和其他人可以稍后学习, 在编译之前或之后,如何判断可执行文件/源代码需要哪些库以及为什么(函数/标头方面)?
我正在使用 VS2010,但在 Linux 机器上使用 g++ 交叉编译它 在这个特定的实例中,我没有将 dll 列为附加依赖项。但我确实在外部依赖项文件夹中看到 glut.h...我只是无法删除它
谢谢
I have been learning opengl for about 4-5 months now.
I am ready to stop using glut(a helper library that obfuscates many difficult / tedious aspects of opengl programming )
Problem is, I feel I have removed all refrences to glut.h, as well as all function calls within glut, but when I run my application it is still trying to link to glut32.dll.
Generally so I and others can learn for later,
How can I tell which libraries an excutable/source-code need and why(function/header wise), either before or after compile?
I am using VS2010 but cross compiling this on a linux box with g++
In this specific instance I don't have the dll listed as an additional dependency . But I do see glut.h in the extrenal dependencies folder...i just cant remove it
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Dependency Walker 是您检查已编译二进制文件的 dll 依赖关系的朋友。
主要问题当然是,您已将 glut.lib 或 glut32.lib 添加到项目中的某个位置。它可能在项目属性>中链接器设置>其他库或某些源文件包含类似这样的#pragma:-
Dependency Walker is your friend for examining the dll dependencies of compiled binaries.
The principal problem is of course, you have added glut.lib or glut32.lib to your project someplace. Its probably in the Project Properties > Linker Settings > Additional Libraries, or some source file contains a #pragma something like this :-
查看您项目的链接器属性。 dll,或者更确切地说,相应的 .lib 应列在“附加依赖项”下。
编辑:
顺便说一句,包含标头和链接库(或 dll)是两件不同的事情。您可能在某处包含标头,但没有链接到相应的库。在这种情况下,链接器会给你一个错误。另一方面,您可能不包含标头,并且根本不使用该库,但您可能仍然链接到它。
在这种情况下,我们似乎两者都有。如果 glut.h 位于外部依赖项文件夹中,那么您必须将其包含在代码中的某个位置。尝试使用“在文件中查找”来查找它。或者从系统中完全删除它并尝试编译。
Look at the linker properties for you project(s). The dll, or rather, the corresponding .lib should be listed there under "additional dependencies".
Edit:
By the way, including a header and linking a library (or a dll) are two different things. You may be including a header somewhere, but not linking to the corresponding library. In that case, the linker will give you an error. On the other hand, you may not be including the header, and not using the library at all, but you may still be linking to it.
In this case it seems like we have both. If glut.h is in the external dependencies folder then you must be including it somewhere in your code. Try using find-in-files to look for it. Or delete it from your system altogether and try to compile.
每个 exe/dll 都有一个称为导入地址表 (IAT) 的东西,它是存储在 PE(可移植可执行文件:窗口的可执行文件格式)文件头中的信息,有关加载相关模块时加载程序需要加载哪些 dll。您可以使用 PE Viewer 或 PE Explorer 等工具来查看此信息或编写自己的信息(这比较困难)。您将看到静态链接到可执行文件的库。如果您在任何这些文件中都没有看到 glut32.dll,则它可能是通过其他 openGL 库中的 LoadLibrary api 动态加载的。我对 openGL 二进制文件不是很熟悉,所以我无法为您确认这一点。
Every exe/dll has something called an Import Address Table (IAT) which is information stored in the PE (Portable Executable: window's executable file format) file's header about what dlls the loader needs to load when the module in question is loaded. You can use tools like PE Viewer or PE Explorer to view this information or write your own (this is more difficult). What you will see are libraries that are statically linked to your executable. If you don't see glut32.dll in any of those files, it is possible that it is loaded dynamically through LoadLibrary api in some other openGL library. I am not very familiar with openGL binaries, so I cannot confirm this for you.
如果您无法找到 glut.lib 在 Visual Studio 项目选项中的隐藏位置,请在标准文本编辑器中打开 .vcproj 并进行全文搜索。
If you have problems to find where glut.lib is hidden in the visual studio project options, open the .vcproj in a standard text editor and make a full text search.