问题描述
在我的项目中,我想使用来自非官方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.dll
和freeglut.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:
- 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!