Not sure what im doing wrong, GL/Glew.h and GL/freeglut.h problem

I use windows 7 and codeblocks

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <GL/glew.h>
#include <GL/freeglut.h>
#define WINDOW_TITLE_PREFIX "Chapter 1"

int CurrentWidth = 800,
    CurrentHeight = 600,
    WindowHandle = 0;

void Initialize(int, char*[]);
void InitWindow(int, char*[]);
void ResizeFunction(int, int);
void RenderFunction(void);

int main(int argc, char* argv[])
{
    Initialize(argc, argv);

    glutMainLoop();

    exit(EXIT_SUCCESS);
}

void Initialize(int argc, char* argv[])
{
    InitWindow(argc, argv);

    fprintf(
        stdout,
        "INFO: OpenGL Version: %s
",
        glGetString(GL_VERSION)
    );

    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
}

void InitWindow(int argc, char* argv[])
{
    glutInit(&argc, argv);

    glutInitContextVersion(4, 0);
    glutInitContextFlags(GLUT_FORWARD_COMPATIBLE);
    glutInitContextProfile(GLUT_CORE_PROFILE);

    glutSetOption(
        GLUT_ACTION_ON_WINDOW_CLOSE,
        GLUT_ACTION_GLUTMAINLOOP_RETURNS
    );

    glutInitWindowSize(CurrentWidth, CurrentHeight);

    glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);

    WindowHandle = glutCreateWindow(WINDOW_TITLE_PREFIX);

    if(WindowHandle < 1) {
        fprintf(
            stderr,
            "ERROR: Could not create a new rendering window.
"
        );
        exit(EXIT_FAILURE);
    }

    glutReshapeFunc(ResizeFunction);
    glutDisplayFunc(RenderFunction);
}

void ResizeFunction(int Width, int Height)
{
    CurrentWidth = Width;
    CurrentHeight = Height;
    glViewport(0, 0, CurrentWidth, CurrentHeight);
}

void RenderFunction(void)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glutSwapBuffers();
    glutPostRedisplay();
}



Main errors:[SIZE=1]C:\Users\Owner\Desktop\xxx.cpp\xxx\aaa\sdf\Cube_Spin\main.cpp:4:21: error: GL/glew.h: No such file or directory

C:\Users\Owner\Desktop\xxx.cpp\xxx\aaa\sdf\Cube_Spin\main.cpp:5:25: error: GL/freeglut.h: No such file or directory
[/SIZE]

I think that if i could fix these everything else would go away. I dont understand what im doing wrong and im a complete begginer with OpenGL. :slight_smile:

[QUOTE=moonbeamer2234;1240842]Main errors:[SIZE=1]C:\Users\Owner\Desktop\xxx.cpp\xxx\aaa\sdf\Cube_Spin\main.cpp:4:21: error: GL/glew.h: No such file or directory

C:\Users\Owner\Desktop\xxx.cpp\xxx\aaa\sdf\Cube_Spin\main.cpp:5:25: error: GL/freeglut.h: No such file or directory
[/SIZE]
…I dont understand what im doing wrong and im a complete begginer with OpenGL.[/QUOTE]

Looks like you need to install GLEW and FreeGLUT (if not already installed). If you still get these errors after install, you should provide an include path to your compiler to tell it where to look for these header files.

where do i install these?

GLEW http://glew.sourceforge.net/
GLUT The freeglut Project :: About
you must put .dll .lib and .h files in appropriate places
to do that watch this
C++ OpenGL Lesson 1: A Simple OpenGL Project - YouTube