Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 217
Irbis Avatar asked Oct 06 '22 22:10

Irbis


1 Answers

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.

like image 62
Nicol Bolas Avatar answered Oct 10 '22 04:10

Nicol Bolas