c - 跳过 OpenGL 预编译 header

标签 c opengl header precompiled

嘿伙计们,我现在的编码遇到了问题。 问题是我的#Include <glut.h>查找 Precompiled Header Use 时文件被跳过,无法找到解决方法。

这是我的代码:

#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;
}

最佳答案

这可能是因为非常奇怪的绝对路径使用以及驱动器说明符。

不要这样做,包含路径不应包含该级别的内容。

就说#include <GL/glut.h>并调整编译器的设置以将所需的目录添加到包含路径中。

关于c - 跳过 OpenGL 预编译 header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15092207/

相关文章:

统计输入了多少个 'x'字符——scanf提示两次而不等待输入

c - 将视频输出到文件和管道 : simultaneously using FFmpeg Libav

c - OpenGL 1.4。当我使用鼠标拾取更改旋转中心时,场景会发生变化

networking - Kotlin 中的 Okhttp3,String.mediaType() 不起作用

c - 如何在用 UTF8 编码的 C 中打印 unicode 字符?

c++ - 在 OSG 中创建太阳光源

c++ - 构造函数在错误的时间调用

c - 删除 HTTP header 信息

PHP/ curl : HEAD Request takes a long time on some sites

c - 关于c中标记化的问题