为什么Visual Studio试图链接"freeglutd.lib"? [英] Why is Visual Studio Trying to Link 'freeglutd.lib'?

查看:205
本文介绍了为什么Visual Studio试图链接"freeglutd.lib"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Visual Studio 2013编译OpenGL程序,但是出现以下错误:

I'm trying to compile an OpenGL program using Visual Studio 2013, but I get the following error:

错误1错误LNK1104:无法打开文件 'freeglutd.lib'...

Error 1 error LNK1104: cannot open file 'freeglutd.lib' ...

作为参考,我安装了FreeGLUT,并已配置VS在正确的目录中搜索包含文件和库文件.确实,VS可以识别GLUT包含文件.我还向其他依赖项中添加了 opengl32.lib freeglut.lib .

For reference, I have FreeGLUT installed and have configured VS to search the correct directories for the include files and library files. Indeed, VS recognises the GLUT include files just fine. I've also added opengl32.lib and freeglut.lib to the Additional Dependencies.

VS为什么要寻找"freeglutd.lib"?绝对没有在其他依赖项"中列出.我可以通过将'libglut.lib'重命名为'libglutd.lib'并从依赖项中删除前者来解决编译错误,但是我很好奇为什么它采用这种方式.

Why is VS looking for 'freeglutd.lib'? It's definitely not listed in the Additional Dependencies. I can solve the compilation error by renaming 'libglut.lib' to 'libglutd.lib' and removing the former from the dependencies, but I'm just curious why it's behaving this way.

说到其他依赖关系,是否真的有必要添加opengl32.lib?我可以不用它来编译我的(非常基础的)程序,但是有一个以上的人说过,这也许是旧版Visual Studio所必需的?

Speaking of Additional Dependencies, is adding opengl32.lib actually necessary? I can compile my (very basic) program without it, but more than one person has said it's required, perhaps for older versions of Visual Studio?

推荐答案

如果您检查了freeglut_std.h(freeglut V3.0):

if you check the freeglut_std.h (freeglut V3.0):

            /* Link with Win32 shared freeglut lib */
#           if FREEGLUT_LIB_PRAGMAS
#               ifdef NDEBUG
#                   pragma comment (lib, "freeglut.lib")
#               else
#                   pragma comment (lib, "freeglutd.lib")
#               endif
#           endif

因此,如果您未定义NDEBUG,则链接器将链接到"freeglutd.lib", 您可以通过在"PreprocessorDefinitions"中定义NDEBUG来解决该问题. 祝你好运!

so if you don't define NDEBUG, the linker will link to "freeglutd.lib", you can solve that by defining a NDEBUG in "PreprocessorDefinitions". Good luck!

这篇关于为什么Visual Studio试图链接"freeglutd.lib"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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