Not Found Linker Error

Sid Kraft 51 Reputation points
2026-07-26T13:51:22.54+00:00

Rather disturbing, been running C++ with Visual Studio, OpenGL and glutInit. Have glut.h in the file "c:\freeglut3.0.18\include\GL\glut.h, have saved in the project winap properties VC++, C++ library directories as "c:\freeglut3.0.18\include\GL\ and the Linker as glut.h. Has worked fine but have recently added the command glutInit(...). now get a linker error, cannot find file 'glut.h', winap is my project name. Any help please, this activity has been rather "challenging" to say the least, Sid Kraft.

Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other

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.

0 comments No comments

1 answer

Sort by: Most helpful
  1. AI answer

    2026-07-26T13:51:36.5+00:00

    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:

    1. In the source file, include the header, not in linker inputs:
      • #include <GL\glut.h>
    2. In project settings, set the include path to the folder that contains the GL folder:
      • VC++ Directories > Include Directories = c:\freeglut3.0.18\include
      • Do not set it to ...\include\GL\ if the code uses #include <GL\glut.h>.
    3. Remove glut.h from:
      • Linker > Input > Additional Dependencies The linker expects .lib files there, not header files.
    4. If a GLUT library is required by the project, add the corresponding .lib file name in Additional Dependencies, and make sure its folder is listed in:
      • Linker > General > Additional Library Directories
      • or VC++ Directories > Library Directories
    5. If the library path contains spaces, ensure it is quoted where required.
    6. 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 /LIBPATH is 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:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.