Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
640 views
in Technique[技术] by (71.8m points)

linker - freeglut error LNK1104

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

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.

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'. 

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

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

What is wrong ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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

  • FREEGLUT_STATIC
  • _LIB
  • FREEGLUT_LIB_PRAGMAS=0

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...