質問

Hey guys I'm having a problem with my coding at the moment. The Problem is that my #Include <glut.h> File is being skipped when looking for Precompiled Header Use and cannot find a way to solve it.

Here is my code:

#include <D:/GL/glut.h>
#include <stdafx.h>
#include <stdlib.h>
#include <malloc.h>
#include <math.h>

using namespace System;

void drawScene(void)
{
    int i, j;

    glClear(GL_COLOR_BUFFER_BIT);
    glColor3f(0.0, 0.0, 0.0);
    glLoadIdentity();

     glTranslatef(0.0, 0.0, -25.0); 
    glutWireCube(5.0); // Box.
    glColor3f(1.0, 0.0, 0.0);

    for(i=5; i<5; i++)
    {
        for (j = -5; j < 5; j++)
        {

            glPushMatrix();
            glTranslatef(i*5, j*5, -35.0);
            glColor3f(1.0, 1.0, 0);
            glutSolidCube(5.0);
            glColor3f(0.0, 0.0, 1.0);
            glutWireCube(5.0);
            glPopMatrix();
        }
    }

glFlush();

}

void setup(void)
{
    glClearColor(1.0, 1.0, 1.0, 0.0);
}

void resize (int w, int h)
{
    glViewport(0, 0, (GLsizei)w, (GLsizei)h); 
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glFrustum(-10.0, 10.0, -10.0, 10.0, 10.0, 100.0);
    glMatrixMode(GL_MODELVIEW);
}

void KeyInput(unsigned char key, int x, int y)
{
    switch(key)
    {
    case 27:
        exit(0);
    break;
    default:
    break;
    }
}


int main(int argc, char **argv) 
{
   glutInit(&argc,argv);
   glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
   glutInitWindowSize(500,500); /* Size of the Program Window */
   glutInitWindowPosition(100,100);
   glutCreateWindow("Voxel Assignment"); 
   setup();
   glutDisplayFunc(drawScene); 
   glutReshapeFunc(resize);
   glutKeyboardFunc(KeyInput);
   glutMainLoop(); 

   return 0;
}
役に立ちましたか?

解決

It's probably because of the very strange absolute path usage, with drive specifier.

Don't do that, include paths are not supposed to include stuff at that level.

Just say #include <GL/glut.h> and adjust your compiler's settings to add the required directory to the include path.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top