DevIL 库文件和依赖项 [英] DevIL library files and dependencies

查看:37
本文介绍了DevIL 库文件和依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,事情就是这样.我有我需要的所有 IL 文件,即

Okay, here's the thing. I have all the IL files I need, namely

DevIL.dll
DevIL.lib

ILU.dll
ILU.lib

ILUT.dll
ILUT.lib

config.h
config.h.in
devil_cpp_wrapper.h
devil_internal_exports.h
il.h
ilu.h
ilu_region.h
ilut.h
ilut_config.h

我的项目目录如下所示,假设我的项目名称是Project1"

My project directory looks like this, let's say my project's name is "Project1"

                 |-Debug---Project1.pdb
                 |
                 |            |---Debug---[loads of files]
                 |            |
                 |            |---Glut---[OpenGL files]
                 |            |
                 |            |---IL---[all the files mentioned above]
                 |-Project1---|
                 |            |---image.bmp
Project Folder---|            |
                 |            |---[header and .cpp files I made in the project]
                 |            |
                 |            |---[files produced by Visual Studio]
                 |          
                 |-ipch---[unrelated stuff]
                 |
                 |-Project1.sln
                 |
                 |-[other files VS created]

如上所述,我已将所有 DevIL 文件放在 IL 文件夹中,并且我确定我使用的是它们的 unicode 兼容版本,因为我在项目中使用了 Unicode 字符集.在我的附加依赖项"中,我有

I've put all the DevIL files in the IL folder, as mentioned, and I am sure I am using the unicode compatible versions of them, as I am using Unicode Character Set for the project. In my "Additional Dependencies" I have

ilut.lib; ilu.lib; DevIL.lib;

所以,依赖关系就在那里,我知道这不是问题.

So, the dependencies are there, I know that's not the problem.

毕竟,我仍然收到链接器错误,主要是所有 IL 函数的 LNK2019:unresolved external symbol__imp_.

After all that, I am still getting linker errors, mainly LNK2019:unresolved external symbol__imp_ for all the IL functions.

我错过了什么?在我看来,可能与项目属性或文件本身有关...也许我错过了一个文件?

What am I missing? It looks to me like maybe something to do with the project properties or the files themselves...maybe I missed a file?

这是输出消息

1>------ Build started: Project: Final Year Project, Configuration: Debug Win32 ------
1>Build started 29/4/2011 12:46:04 pm.
1>InitializeBuildStatus:
1>  Touching "Debug\Final Year Project.unsuccessfulbuild".
1>ClCompile:
1>  Main.cpp
1>c:\users\xxxx\desktop\final year project 0.2\final year project\main.cpp(152): warning C4390: ';' : empty controlled statement found; is this the intent?
1>c:\users\xxxx\desktop\final year project 0.2\final year project\main.cpp(141): warning C4101: 'alpha' : unreferenced local variable
1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>Main.obj : error LNK2019: unresolved external symbol __imp__ilInit@0 referenced in function "public: static void __cdecl Main::Init(int,char * *)" (?Init@Main@@SAXHPAPAD@Z)
1>Main.obj : error LNK2019: unresolved external symbol __imp__ilDeleteImages@8 referenced in function "public: static void __cdecl Main::DisplayScene(void)" (?DisplayScene@Main@@SAXXZ)
1>Main.obj : error LNK2019: unresolved external symbol __imp__ilGetData@0 referenced in function "public: static void __cdecl Main::DisplayScene(void)" (?DisplayScene@Main@@SAXXZ)
1>Main.obj : error LNK2019: unresolved external symbol __imp__ilConvertImage@8 referenced in function "public: static void __cdecl Main::DisplayScene(void)" (?DisplayScene@Main@@SAXXZ)
1>Main.obj : error LNK2019: unresolved external symbol __imp__ilGetInteger@4 referenced in function "public: static void __cdecl Main::DisplayScene(void)" (?DisplayScene@Main@@SAXXZ)
1>Main.obj : error LNK2019: unresolved external symbol __imp__ilLoadImage@4 referenced in function "public: static void __cdecl Main::DisplayScene(void)" (?DisplayScene@Main@@SAXXZ)
1>Main.obj : error LNK2019: unresolved external symbol __imp__ilBindImage@4 referenced in function "public: static void __cdecl Main::DisplayScene(void)" (?DisplayScene@Main@@SAXXZ)
1>Main.obj : error LNK2019: unresolved external symbol __imp__ilGenImages@8 referenced in function "public: static void __cdecl Main::DisplayScene(void)" (?DisplayScene@Main@@SAXXZ)
1>C:\Users\xxxx\Desktop\Final Year Project 0.2\Debug\Final Year Project.exe : fatal error LNK1120: 8 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.93
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

推荐答案

由于您添加了构建输出,现在答案很简单:您的链接器错误与 DevIL 完全无关.

Since you added the build output, the answer is now easy: your linker errors have nothing to do with DevIL at all.

您需要链接到SDL(简单直接媒体层).

You need to link to SDL (Simple DirectMedia Layer).

由于 SDL 具有 C 接口,并且 - IIRC - 不要求 DLL 使用与应用程序相同的堆,VC8 版本的开发库" 应该没问题(即使您使用 VC10).只需将 SDL.lib 添加到附加依赖项"中,您应该没问题.

Since SDL has a C interface, and - IIRC - doesn't require that the DLL uses the same heap as the application, the VC8 version of the "Development Libraries" should do fine (even if you use VC10). Just add SDL.lib to the "Additional Dependencies" and you should be fine.

编辑

好的.你要么

  1. 未链接到所需的 .lib 文件(DevIL.lib 等)或
  2. 链接损坏/错误的 .lib 文件

至少我想不出其他解释.您的构建日志中提到的名称(__imp__ilInit@0 等)是正确的,并且当前的DevIL SDK"(DevIL 1.7.8 SDK for 32-bit Windows) 在 VC10 上运行良好(我刚刚验证过).

At least there is no other explanation I can think of. The names mentioned in your build log (__imp__ilInit@0 etc.) are correct, and the current "DevIL SDK" (DevIL 1.7.8 SDK for 32-bit Windows) works fine with VC10 (I just verified it).

为确保您链接的是 DevIL.lib 等,请将以下内容放入您的 main.cpp 文件中:

To assure you're linking against DevIL.lib etc. please put the following in your main.cpp file:

#pragma comment(lib, "DevIL.lib")
#pragma comment(lib, "ILU.lib")
#pragma comment(lib, "ILUT.lib")

要确保您链接的是这些文件的正确版本,请重新下载整个 SDK,然后使用新文件重试.

To make sure you're linking against the correct version of those files, re-download the whole SDK and try again with the new files.

编辑 2

既然我得到了一半的奖励,我觉得我应该更有帮助:)

Since I got half the reward, I feel I should be more helpful :)

您可以尝试的最后一件事:启用详细链接器输出以检查链接器是否找到了正确版本的 DevIL.lib.(如果它没有找到任何 DevIL.lib,你会得到一个错误 LNK1104: cannot open file 'DevIL.lib' - 因为你没有得到那个消息,这不可能是问题.)

One last thing you can try: enable verbose linker output to check if the linker finds the correct version of DevIL.lib. (If it didn't find any DevIL.lib, you would get an error LNK1104: cannot open file 'DevIL.lib' - and since you're not getting that message, that cannot be the problem.)

要启用详细链接器输出,请添加 /VERBOSE 开关(在配置设置 -> 链接器 -> 命令行 -> 附加选项下).

To enable verbose linker output, add the /VERBOSE switch (under Configuration Settings -> Linker -> Command Line -> Additional Options).

这会给您带来大量消息.将它们复制到您喜欢的编辑器中,然后搜索包含 DevIL.lib 的行.其中一行应该是 Searching X:\path\to\DevIL.lib: - 这是链接器正在使用的 DevIL.lib 副本的路径.如果那不是您从下载的 SDK 中复制文件的路径,那么您已经找到了问题.

That will give you a ton of messages. Copy them into your favorite editor, and search for lines containing DevIL.lib. One of the lines should read Searching X:\path\to\DevIL.lib: - that's the path to the copy of DevIL.lib the linker is using. If that's not the path where you copied the files from the SDK you downloaded, you have found the problem.

如果没有包含 DevIL.lib 的行,那么链接器甚至不会尝试定位它.但是,我从未见过 #pragma comment 失败,所以如果您确实添加了那些几乎肯定不会出现这种情况的行.

And if there are no lines containing DevIL.lib, then the linker isn't even trying to locate it. However I've never seen #pragma comment fail, so if you indeed added those lines that almost surely cannot be the case.

顺便说一句:如果您设法解决了这个问题,请告诉我.这太奇怪了,我真的很想知道发生了什么:)

BTW: please let me know if you managed to solve this. This is so strange that I really want to know what was going on :)

这篇关于DevIL 库文件和依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆