Lỗi redefination int right trong thư viện graphics.h năm 2024

Lỗi: C2381: 'exit' : redefinition; __declspec(noreturn) differs trong opengl(C++) sửa như thế nào ?

Mã:

// ConsoleApplication12.cpp : Defines the entry point for the console application.//

include "stdafx.h"

include "glut.h"

include<gl\GL.h>

include <stdlib.h>

include"graphics.h"

include <time.h>

include <math.h>

include<Windows.h>

include<stdio.h> float angle = 0;float polygons [45] [45] [3];int wiggler =0;GLfloat hold; void initrendering(){ glEnable(GL_DEPTH_TEST); glEnable(GL_COLOR_MATERIAL);} void handleResize (int width, int height){ glViewport(0,0,width,height); glMatrixMode(GL_PROJECTION); gluPerspective(45.0, (double) width /(double)height, 1.0, 200);}void initData(){ for (int x=0; x<45; x++) { for (int y=0; y<45;y++) { polygons[x][y][0] = float ((x/5.0f)-4.5f); polygons[x][y][0] = float ((x/5.0f)-4.5f); polygons[x][y][0] = float (sin((((x/5.0f)40.0f)/360.0f)3.141592654*2.0f)); } }} void draw(){ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0,0,-10); glPushMatrix(); glBegin(GL_QUADS); glTranslatef(0,0,-10); glRotated(angle,1,0,1); for (int x = 0; x<45; x++) { for (int y = 0; y<45; y++) { glVertex3f(polygons[x][y][0], polygons[x][y][1], polygons[x][y][2]); glVertex3f(polygons[x][y+1][0], polygons[x][y+1][1], polygons[x][y+1][2]); glVertex3f(polygons[x+1][y+1][0], polygons[x+1][y+1][1], polygons[x+1][y+1][2]); glVertex3f(polygons[x+1][y][0], polygons[x+1][y][1], polygons[x+1][y][2]); } } glEnd(); glPopMatrix(); glutSwapBuffers();} void lightPosition(float x, float y, float z, float strenght){ GLfloat lightPosition[] = {x,y,z,strenght}; glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);} void initLight(){ glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); GLfloat ambientLight[] = {0.2,0.2,0.2,1.0}; GLfloat diffuseLight[] = {0.8,0.8,0.8,1.0}; GLfloat specularLight[] = {1.0,1.0,1.0,1.0}; glLightfv(GL_LIGHT0,GL_AMBIENT, ambientLight); glLightfv(GL_LIGHT0,GL_DIFFUSE, diffuseLight); glLightfv(GL_LIGHT0,GL_SPECULAR, specularLight); lightPosition(0,0,-0.1,0);} void update(int value){ angle++; if (wiggler == 2) { for (int x = 0; x<45; x ) { hold = polygons[0][x][2]; for (int y = 0; y < 45; y) { polygons[x][y][2] = polygons[x+1][y][2]; } polygons[44][44][2] = hold; } wiggler = 0; } wiggler++; glutPostRedisplay(); glutTimerFunc(10,update,0);}int main(int argc, char argv){ glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH); glutInitWindowSize(800,600); glutCreateWindow("la co 3D"); initrendering(); initLight(); initData(); glutDisplayFunc(draw); glutReshapeFunc(handleResize); glutTimerFunc(10,update,0); glutMainLoop(); return 0;}

View more random threads:

Tìm vị trí kí tự xuất hiện lần đầu trong chuỗi Mình bị mất cái phần kiểm tra lỗi trong VC6 giao tiếp web service C# và VC++ Load ảnh có nền trong suốt trong MFC? Ubuntu, cách cài và sử dụng Ubuntu? Cách sử dụng hàm PlaySound, và công dụng của hàm PlaySound như thế nào? Làm sao để đo thời gian chạy các thuật toán? nhập dữ liệu từ các client và tổng hợp tức thì trên form sever Hỏi về mã hóa file nhị phân bằng thao tách bit trong C++ Lỗi: debug assertion failed xử lý thế nào?