freeglut错误LNK1104 [英] freeglut error LNK1104

查看:448
本文介绍了freeglut错误LNK1104的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我想使用来自非官方opengl sdk的freeglut库.

In my project I want to use a freeglut library from the unofficial opengl sdk.

我使用Premake为vs2010生成了构建文件.然后,我构建了所有库(调试).在我的项目中,我为freeglut设置了其他包含目录,其他库目录.在其他依赖项中,我添加了freeglutD.lib.

I used Premake to generate build files for vs2010. Then I built all libraries (debug). In my project I set Additional Include Directories, Additional Library Directories for the freeglut. In additional dependencies I added freeglutD.lib.

在代码中,我只包含一个freeglut标头.当我想运行程序时,出现错误:

In the code I just include a freeglut header. When I want to run the program I get an error:

>LINK : fatal error LNK1104: cannot open file 'freeglut.lib'. 

freeglutD.lib是sdk/freeglut/lib中的唯一文件. sdk中没有freeglut.dllfreeglut.lib.

The freeglutD.lib is the only file in sdk/freeglut/lib. There is no freeglut.dll and freeglut.lib in sdk.

之前我使用的是链接中的freeglut 2.8.0 MSVC程序包被动态链接(包含freeglut.dll),并且一切正常.

Earlier I was using freeglut 2.8.0 MSVC Package from link which is linked dynamically (contain freeglut.dll) and everything works fine.

怎么了?

推荐答案

我的猜测是您从使用SDK的文档中忘记了以下几行:

My guess is that you forgot these lines from the documentation on using the SDK:

您还需要在命令行中添加一些#define.这些是:

You will also need to add some #defines to your command line. These are:

  • FREEGLUT_STATIC
  • _LIB
  • FREEGLUT_LIB_PRAGMAS = 0
  • FREEGLUT_STATIC
  • _LIB
  • FREEGLUT_LIB_PRAGMAS=0

您需要那个FREEGLUT_STATIC来让GLUT知道它是静态链接的.否则,它将查找DLL.

You need that FREEGLUT_STATIC to let GLUT know that it's linking statically. Otherwise it looks for a DLL.

这篇关于freeglut错误LNK1104的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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