我正在尝试在 Visual Studio 2010 中使用 C++ 使用 OpenGL 将图像作为纹理加载。我在网上研究了几个小时并找到了 SDL 库,然后我实现了一个简单的示例并遇到了一些我似乎无法弄清楚的链接错误. 错误日志在这里:
1>Build started 10/20/2012 12:09:17 AM.
1>InitializeBuildStatus:
1> Touching "Debug\texture mapping test.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1> texture mapping test.cpp
1>ManifestResourceCompile:
1> All outputs are up-to-date.
1>texture mapping test.obj : error LNK2019: unresolved external symbol _IMG_Load referenced in function "void __cdecl display(void)" (?display@@YAXXZ)
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>C:\Users\Me\Documents\Visual Studio 2010\Projects\Programming projects\texture mapping test\Debug\texture mapping test.exe : fatal error LNK1120: 2 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:02.45
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
我下载了 SDL,并将所有 .h 文件复制到:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include
我将 .lib (x86) 文件添加到:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib
(注意:我也尝试了(x64)文件,但得到了完全相同的错误)
并将 .dll(x86) 放入:
C:\Windows\System32
为了实现纹理,我使用了以下简单示例代码:SDL Tip - SDL Surface to OpenGL Texture