Search code examples
c++openglcompiler-errorsvisual-studio-2017glut

Visual Studio doesn't find GL/glut.h


I'm using Microsoft Visual Studio Community 2017 on Windows 10 and I've been trying to install GLUT using this online guide that I found on this StackOverflow question. However, when I try to compile my code this error still shows up: fatal error C1083: Cannot open include file: 'GL\glut.h': No such file or directory. I've followed every single step line by line, but nothing seems to work. What could be causing this error?

This is how I'm importing the dependencies:

#include <iostream>
#include <Windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <GL/GL.h>
#include <GL/GLU.h>
#include <GL/glut.h>
#include <cstring>
#include "math.h"
#include <conio.h>

Solution

  • For this, I like to use the Nuget package manager. If you go to

    Tools>NuGet Package Manager>Package Manager Console
    

    Then, in the console type:

    Install-Package nupengl.core
    

    Your problem should be fixed.