Я делал некоторое программирование OpenGL в С++.
Это часть моего кода:
Как я могу это исправить?
EDIT: Я использую Microsoft Visual С++ Express Edition. Извините, забыл упомянуть об этом
Вероятно, вы не установили GLUT:
-
Установить GLUT Если у вас нет GLUT, установленного на вашем компьютере, вы можете скачать его с: http://www.xmission.com/
nate/glut/glut-3.7.6-bin.zip (или любая версия) Библиотеки GLUT и файлы заголовков • glut32.lib • glut.h
Самый быстрый способ — загрузить последний заголовок и скомпилированные библиотеки для него, поместить его в папку system32 или ссылаться на него в своем проекте. Версия 3.7 (последняя по состоянию на этот пост) находится здесь: http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip
Если вы используете Visual Studio Community 2015 и пытаетесь установить GLUT, вы должны поместить файл заголовка glut.h в C:Program Files (x86)Windows Kits8.1Includeumgl
Сообщество Visual Studio 2017
Перейдите сюда: C:Program Files (x86)Windows Kits10
и сделайте все, что вы должны были пойти в данном каталоге для VS 13 .
в папке lib вы найдете несколько версий, я скопировал файлы 32-бит glut.lib в amd и x86 и 64-бит glut.lib в каталогах arm64 и x64 в папке um для каждой версии, которую я мог найти.
Это сработало для меня.
EDIT: я пробовал это в Windows 10, возможно, вам нужно перейти в папку C:Program Files (x86)Windows Kits8.1 для окон 8/8.1 .
I was doing some OpenGL programming in C++.
This is part of my code:
How can I fix this?
EDIT: I am using Microsoft Visual C++ Express Edition. Sorry forgot to mention it

5 Answers 5
You probably haven’t installed GLUT:
-
Install GLUT If you do not have GLUT installed on your machine you can download it from: http://www.xmission.com/
nate/glut/glut-3.7.6-bin.zip (or whatever version) GLUT Libraries and header files are • glut32.lib • glut.h
EDIT:
The quickest way is to download the latest header, and compiled DLLs for it, place it in your system32 folder or reference it in your project. Version 3.7 (latest as of this post) is here: http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip
If you are using Visual Studio Community 2015 and trying to Install GLUT you should place the header file glut.h in C:Program Files (x86)Windows Kits8.1Includeumgl
Go here : C:Program Files (x86)Windows Kits10
and do whatever you were supposed to go in the given directory for VS 13.
in the lib folder, you will find some versions, I copied the 32-bit glut.lib files in amd and x86 and 64-bit glut.lib in arm64 and x64 directories in um folder for every version that I could find.
That worked for me.
EDIT : I tried this in windows 10, maybe you need to go to C:Program Files (x86)Windows Kits8.1 folder for windows 8/8.1.

200?’200px’:»+(this.scrollHeight+5)+’px’);»> #include
using namespace std;
void display()
<
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_LINES);
glColor3f(1.0, 0.0, 0.0);
glVertex2f(0.4, 0.4);
glVertex2f(0.4, 0.8);
//
glVertex2f(0.4, 0.8);
glVertex2f(0.8, 0.8);
//
glVertex2f(0.8, 0.8);
glVertex2f(0.8, 0.4);
//
glVertex2f(0.4, 0.4);
glVertex2f(0.8, 0.4);
glEnd();
glFlush();
int main(int argc, char **argv)
<
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(240, 240);
glutInitWindowPosition(100, 740);
glutCreateWindow(«First window!»);
glClearColor(1.0, 1.0, 1.0, 1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
glutDisplayFunc(display);
glutMainLoop();
>