试图让我的游戏在 VC 2010 中运行,似乎无法链接 SOIL 库,不知道如何链接,包括游戏源代码

发布于 2024-11-19 23:46:15 字数 3321 浏览 2 评论 0原文

我已经使用 CodeBlocks 一段时间了,因为我用 C++ 制作了一个小爱好游戏。遇到一个问题,我想随时查看数组中所有数据的当前值,CodeBlocks 似乎没有这种能力。同事(专业游戏程序员)告诉我应该使用 Visual Studio。

以前使用过 Visual Studio C#,非常方便,能够在调试我制作的其他小游戏时使用断点,然后浏览大量监视列表以查看特定数组值或其中的任何其他值我当时的节目。

所以我在VC2010中创建了一个新的空白项目并将我所有的代码文件添加到该项目中。我知道我必须链接库等,在过去的几个小时里一直在试图弄清楚如何做到这一点。但即使完成所有这些之后,我仍然收到链接错误(我认为)

第一个问题是:

fatal error C1083: Cannot open include file: 'gl\glext.h': No such file or directory

所以我将其注释掉,看看我还能走多远。

最终不得不添加到我的 main.cpp 文件中,

#pragma comment (lib, "opengl32.lib")
#pragma comment (lib, "glu32.lib")
#pragma comment (lib, "libsoil.lib")

我最终将 libsoil.a 文件复制到 C:\Program Files\Microsoft Visual Studio 10.0\VC\lib 并将其重命名为 libsoil。 lib (如作者网站 http://www.lonesock.net/soil.html

所以现在我在编译时得到这个

1>libsoil.lib(stb_image_aug.o) : error LNK2019: unresolved external symbol ___chkstk referenced in function _stbi_zlib_decode_noheader_buffer
1>libsoil.lib(image_helper.o) : error LNK2019: unresolved external symbol _sqrtf referenced in function _RGBE_to_RGBdivA2
1>C:\Repositories\HappyHelperPuppy\CppVer\HappyHelperPuppy\Debug\HappyHelperPuppy.exe : fatal error LNK1120: 2 unresolved externals

..而且我不知道下一步该做什么。我花了很长时间在谷歌上搜索并浏览论坛,但我真的不知道该怎么办。

因此,作为最后的努力,我将所有代码和项目文件压缩起来,让任何有兴趣的人查看并看看是否可以找到解决方案。这个游戏不会有任何我想保密的秘密功能,所有的艺术作品都来自很久以前的一场开放游戏竞赛(对于那些知道它是什么的人来说是“TIGSource Assembly”)或来自 DeviantArt(只是想要一些东西)当我制作它时看看,这不会是最终的游戏发行艺术)

代码/游戏可以在这里找到 http://users.on.net/~infernoraven/hhp_busted_code.zip (27mb)

SOIL 库应该位于其自己的oil.zip 的主目录中

任何帮助都会很好,但我真的很沮丧,因为我似乎把大部分时间都花在与 IDE/编译器或一些恼人的语法问题作斗争上。

CodeBlocks 项目文件也应该在那里,所以如果您...

  • 取消注释 glext.h
  • 链接到 SOIL
  • 链接到 libopengl32 和 libglu32

希望它能为您编译。否则应该有一个由 CodeBlocks 预编译的 HappyHelperPuppy.exe,它应该可以运行并让您了解应该发生的情况。


在 SOIL 包中,有许多用于 Visual Studio 的项目文件。当我尝试加载 VC9 并将其转换为 VC10 时,出现转换错误。

Conversion Report - SOIL.vcproj: 
Converting project file 'C:\Documents and Settings\Administrator\My Documents\Downloads\soil\Simple OpenGL Image Library\projects\VC9\SOIL.vcproj'. 
Failed to upgrade platform 'x64'. Please make sure you have it installed under '%vctargetspath%\platforms\x64' 
VCWebServiceProxyGeneratorTool is no longer supported. The tool has been removed from your project settings. 
Attribute 'Detect64BitPortabilityProblems' of 'VCCLCompilerTool' is not supported in this version and has been removed during conversion. 
Attribute 'Detect64BitPortabilityProblems' of 'VCCLCompilerTool' is not supported in this version and has been removed during conversion. 
Failed to upgrade 'Debug|x64'. Please make sure you have the corresponding platform installed under '%vctargetspath%\platforms\x64' 
The project configuration dimension name/value "(Platform, Win32)" was not found in the project manifest. 
Project upgrade failed. 

如果我使用 VC8 项目文件并尝试升级它,VC2010 生成的 libSOIL.lib 文件会抛出错误,提示“无法启动程序... \SOIL.lib 指定的文件是无法识别或不受支持的二进制格式”

但是作者在他的网站上指出,我可以简单地将 libSOIL.a 文件重命名为 libSOIL.lib 文件,它应该可以工作。

I've been using CodeBlocks for a while now as I make a little hobby game in C++. Come across a snag whereby I want to see the current values of all the data in my arrays at any point, CodeBlocks doesn't seem to have that ability. Have been told by workmates (professional game programmers) that I should use Visual Studio.

Have previously used Visual Studio C# in the past, was very handy being able to use a break point while debugging other small games I've made and then going through the big list of watches to look at particular array values or any other value from within my program at that time.

So I've created a new blank project in VC2010 and added all my code files to the project. I know I have to link libraries and such, have spent the last few hours trying to figure out how to do that. But even after all that is done, I'm still getting link errors (I think)

First problem is this:

fatal error C1083: Cannot open include file: 'gl\glext.h': No such file or directory

So I commented it out to see how much further I could get.

Eventually had to add to my main.cpp file

#pragma comment (lib, "opengl32.lib")
#pragma comment (lib, "glu32.lib")
#pragma comment (lib, "libsoil.lib")

I ended up copying the libsoil.a file to C:\Program Files\Microsoft Visual Studio 10.0\VC\lib and renaming it to libsoil.lib (as stated on the authors's website http://www.lonesock.net/soil.html)

So now I get this when I compile

1>libsoil.lib(stb_image_aug.o) : error LNK2019: unresolved external symbol ___chkstk referenced in function _stbi_zlib_decode_noheader_buffer
1>libsoil.lib(image_helper.o) : error LNK2019: unresolved external symbol _sqrtf referenced in function _RGBE_to_RGBdivA2
1>C:\Repositories\HappyHelperPuppy\CppVer\HappyHelperPuppy\Debug\HappyHelperPuppy.exe : fatal error LNK1120: 2 unresolved externals

..And I have no idea what to do next. I've spent ages in Google and trawling through forums and I really just don't know what to do.

So as a last ditch effort I'm zipping up all my code and project files and letting anyone whos interested to have a look and see if they can find a solution. It's not like this game will have any secret feature I want to keep under wraps, and all the art is from an open game competition from ages ago ("TIGSource Assembly" for those who know what it is) or from DeviantArt (just wanted something to look at while I made it, wouldn't be final game release art)

The code/game can be found here http://users.on.net/~infernoraven/hhp_busted_code.zip (27mb)

The SOIL library should be in the main directory in its own soil.zip

Any help would be good, but I'm just getting really depressed as I seem to spend most of my time either fighting with the IDE/Compilers or some annoying syntax problem.

The CodeBlocks project files should be in there also, so if you..

  • un-comment out glext.h
  • link to SOIL
  • link to libopengl32 and libglu32

Hopefully it'll compile for you. Otherwise there should be an HappyHelperPuppy.exe that's precompiled by CodeBlocks that should hopefully run and give you an idea of what is suppose to happen


In the SOIL package there are a number of project files for visual studio. When I try to load up the VC9 one and convert it to VC10, I get conversion errors.

Conversion Report - SOIL.vcproj: 
Converting project file 'C:\Documents and Settings\Administrator\My Documents\Downloads\soil\Simple OpenGL Image Library\projects\VC9\SOIL.vcproj'. 
Failed to upgrade platform 'x64'. Please make sure you have it installed under '%vctargetspath%\platforms\x64' 
VCWebServiceProxyGeneratorTool is no longer supported. The tool has been removed from your project settings. 
Attribute 'Detect64BitPortabilityProblems' of 'VCCLCompilerTool' is not supported in this version and has been removed during conversion. 
Attribute 'Detect64BitPortabilityProblems' of 'VCCLCompilerTool' is not supported in this version and has been removed during conversion. 
Failed to upgrade 'Debug|x64'. Please make sure you have the corresponding platform installed under '%vctargetspath%\platforms\x64' 
The project configuration dimension name/value "(Platform, Win32)" was not found in the project manifest. 
Project upgrade failed. 

If I use the VC8 project file and try to upgrade that, a libSOIL.lib file is generated by VC2010 throws an error saying "Unable to start program ... \SOIL.lib The specified file is an unrecognized or unsupported binary format"

But the author on his site states that I can simply rename the libSOIL.a file to a libSOIL.lib file and it should work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不弃不离 2024-11-26 23:46:16

sat.zip 文件在项目文件夹下包含一些 .sln 文件。使用正确的 .sln 文件构建库,然后将您的项目链接到该库。在我这边效果很好。

The soil.zip file contains some .sln files under the folder projects. Use the proper .sln file to build the library, then link your project against this library. It worked fine on my side.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文