A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.
glut.h is a header file, not a linker input. The linker errors LNK1181 and LNK1104 occur when the linker is told to open a file that does not exist as an input library, or when the path is wrong.
For OpenGL/GLUT setup in Visual Studio:
- In the source file, include the header, not in linker inputs:
-
#include <GL\glut.h>
-
- In project settings, set the include path to the folder that contains the
GLfolder:- VC++ Directories > Include Directories =
c:\freeglut3.0.18\include - Do not set it to
...\include\GL\if the code uses#include <GL\glut.h>.
- VC++ Directories > Include Directories =
- Remove
glut.hfrom:- Linker > Input > Additional Dependencies
The linker expects
.libfiles there, not header files.
- Linker > Input > Additional Dependencies
The linker expects
- If a GLUT library is required by the project, add the corresponding
.libfile name in Additional Dependencies, and make sure its folder is listed in:- Linker > General > Additional Library Directories
- or VC++ Directories > Library Directories
- If the library path contains spaces, ensure it is quoted where required.
- Make sure the library architecture matches the build target:
- 32-bit library with 32-bit build
- 64-bit library with 64-bit build
Why this happens:
-
LNK1181: the linker cannot open an input file because the file does not exist or/LIBPATHis missing. -
LNK1104: common causes include incorrect library path, wrong architecture, or specifying the wrong file as a linker dependency.
Also, for Windows OpenGL headers:
- OpenGL core uses
<GL\gl.h> - WGL and Windows support require
Windows.h
References: