2

I want to begin programming with C++ OpenGl, and thus have downloaded freeglut to be included in my programn.

I have defined statically FREEGLUT_STATIC

Here is my source.cpp:

#include <GL\glew.h>
#include <GL\GLU.h>
#include <GL\freeglut.h>

#include "Source.h"

using namespace std;

int main()
{
    return 0;
}

source.h

#define FREEGLUT_STATIC

But it does not work, the error is:

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

It's worth mentioning that I have added the libraries directories to the project, and even when I type Gl/ visual studio 2013 automatically suggest the libraries and headers which means it knows the directory,

Mostafa Talebi
  • 8,825
  • 16
  • 61
  • 105

2 Answers2

2

I have found the problem. I should simlpy do the following:

Right click on my project in Visual Studio, go to the properties, and then to VC++ Directories, click on "Library Directories" and then add a new path:

under the freeglut main directory in your hard drive, there is a folder called lib/x86/Debug, just add the full path and then apply that.

Your script should be executed properly.

Mostafa Talebi
  • 8,825
  • 16
  • 61
  • 105
1

The include works alright (otherwise you'd get an error at compile time, not at link time). The library file itself (freeglut.lib) seems to be missing. This SO question addreses your problem.

EDIT: Updated my answer because obviously just the binary for the lib is missing. Same link already given in a comment by swaldi.

Community
  • 1
  • 1
Axel
  • 13,939
  • 5
  • 50
  • 79
  • it is a file "freeglut.lib" ? There is no such thing in my freeglut folder. – Mostafa Talebi Aug 18 '14 at 12:28
  • Sorry, my fault. You already have it in your linker settings, otherwise the linker wouldn't know what to look for. Seems you are not the first to have this problem. Please see here: http://stackoverflow.com/questions/12300059/freeglut-compiled-dll-lib. – Axel Aug 18 '14 at 14:22