链接器错误:未定义的引用
我正在使用 本文。
我只需将源代码复制并粘贴到我自己的项目中,Dev-C++ 就会找到所有包含的内容;但是,当我编译时,我收到了一系列“链接器错误”,如下所示:
[Linker error] undefined reference to _imp__ilGenImages@8
我是否以某种方式不正确地设置了我的环境?我该如何修复它?
I'm using the source code in this article.
I've simply copy and pasted the source to my own project, and Dev-C++ is finding all of the includes; however, when I compile I receive a slew of "linker errors" such as the following:
[Linker error] undefined reference to _imp__ilGenImages@8
Have I set up my environment improperly somehow? How do I fix it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您是否已将您的应用程序与 Devil 中包含的 lib 文件链接起来?
Have you linked your application against the lib-files included with Devil?
您是否已将
devil.lib
添加到链接器依赖项中?Have you added
devil.lib
to your linker dependencies?您可能忘记链接静态库。请阅读编译器的手册,了解如何在您的情况下执行此操作。
You probably forgot to link against the static libraries. Read the manual of your compiler to find out how to do that in your case.
Dev-Cpp 使用 GNU 编译器。它无法理解 .lib 文件。如果您仍然想使用 DevIL,您应该从源代码构建它(可从 他们的网站 获得;需要一些也依赖),使用 Visual Studio (这是更轻松的方式)或使用其他库(SDL_image ,SFML 就足够了)。
Dev-Cpp uses GNU compiler. It could not understand .lib files. If you still wanna use DevIL, you should build it from sources (avaliable from their site ; needs some dependices too), use Visual Studio (which is more painless way) or use another library (SDL_image, SFML would be good enough).