Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8381831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:47:06+00:00 2026-06-09T16:47:06+00:00

I’m trying to set up an OpenGL project using GLFW in Visual c++ 2008

  • 0

I’m trying to set up an OpenGL project using GLFW in Visual c++ 2008 (Windows 7). I have added the GLFW include and library directories to the project’s include and library paths, and I have put the following in additional dependencies:

GLFW.lib glu32.lib opengl32.lib

That is everything I need to do, isn’t it? But when I try to compile any OpenGl program (except an extremely simple one that only clears the screen using glClear) I get a bunch of undeclared identifier and identifier not found erros. Any Idea why this can happen?
Here is the complete error list:

1>Compiling...
1>main.cpp
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(9) : error C2146: syntax error : missing ';' before identifier 'VBO'
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(9) : error C2377: 'GLuint' : redefinition; typedef cannot be overloaded with any other symbol
1>        c:\program files\microsoft sdks\windows\v6.0a\include\gl\gl.h(52) : see declaration of 'GLuint'
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(9) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(43) : error C3861: 'glEnableVertexAttribArray': identifier not found
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(45) : error C2065: 'GL_ARRAY_BUFFER' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(45) : error C3861: 'glBindBuffer': identifier not found
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(47) : error C3861: 'glVertexAttribPointer': identifier not found
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(55) : error C3861: 'glDisableVertexAttribArray': identifier not found
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(78) : error C3861: 'glGenBuffers': identifier not found
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(80) : error C2065: 'GL_ARRAY_BUFFER' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(80) : error C3861: 'glBindBuffer': identifier not found
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(82) : error C2065: 'GL_ARRAY_BUFFER' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(82) : error C2065: 'GL_STATIC_DRAW' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(82) : error C3861: 'glBufferData': identifier not found
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(87) : error C2146: syntax error : missing ')' before identifier 'ShaderProgram'
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(87) : error C2182: 'AddShader' : illegal use of type 'void'
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(87) : error C2440: 'initializing' : cannot convert from 'Vector3f' to 'int'
1>        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(87) : error C2059: syntax error : ')'
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(89) : error C2143: syntax error : missing ';' before '{'
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(89) : error C2447: '{' : missing function header (old-style formal list?)
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(144) : error C2146: syntax error : missing ';' before identifier 'ShaderProgram'
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(144) : error C2065: 'ShaderProgram' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(144) : error C3861: 'glCreateProgram': identifier not found
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(148) : error C2065: 'ShaderProgram' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(158) : error C2065: 'ShaderProgram' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(158) : error C2065: 'GL_VERTEX_SHADER' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(160) : error C2065: 'ShaderProgram' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(160) : error C2065: 'GL_FRAGMENT_SHADER' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(166) : error C2065: 'GLchar' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(166) : error C2146: syntax error : missing ';' before identifier 'ErrorLog'
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(166) : error C2065: 'ErrorLog' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(166) : error C2059: syntax error : '{'
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(166) : error C2143: syntax error : missing ';' before '{'
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(166) : error C2143: syntax error : missing ';' before '}'
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(170) : error C2065: 'ShaderProgram' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(170) : error C3861: 'glLinkProgram': identifier not found
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(172) : error C2065: 'ShaderProgram' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(172) : error C2065: 'GL_LINK_STATUS' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(172) : error C3861: 'glGetProgramiv': identifier not found
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(176) : error C2065: 'ShaderProgram' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(176) : error C2065: 'ErrorLog' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(176) : error C2070: ''unknown-type'': illegal sizeof operand
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(176) : error C2065: 'ErrorLog' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(176) : error C3861: 'glGetProgramInfoLog': identifier not found
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(178) : error C2065: 'ErrorLog' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(186) : error C2065: 'ShaderProgram' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(186) : error C3861: 'glValidateProgram': identifier not found
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(188) : error C2065: 'ShaderProgram' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(188) : error C2065: 'GL_VALIDATE_STATUS' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(188) : error C3861: 'glGetProgramiv': identifier not found
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(192) : error C2065: 'ShaderProgram' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(192) : error C2065: 'ErrorLog' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(192) : error C2070: ''unknown-type'': illegal sizeof operand
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(192) : error C2065: 'ErrorLog' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(192) : error C3861: 'glGetProgramInfoLog': identifier not found
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(194) : error C2065: 'ErrorLog' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(202) : error C2065: 'ShaderProgram' : undeclared identifier
1>c:\glfw-2.7.3\opengl ikasi\main.cpp(202) : error C3861: 'glUseProgram': identifier not found

EDIT: here is the whole program

#include <stdio.h>

#include <string.h>
#include <GL/glfw.h>

#include "math_3d.h"


GLuint VBO;



static const char* pVS = "                                                    \n\
#version 150                                                                  \n\
\n\
layout (location = 0) in vec3 Position;                                       \n\
\n\
void main()                                                                   \n\
{                                                                             \n\
gl_Position = vec4(0.5 * Position.x, 0.5 * Position.y, Position.z, 1.0);  \n\
}";


static const char* pFS = "                                                    \n\
#version 150                                                                  \n\
\n\
out vec4 FragColor;                                                           \n\
\n\
void main()                                                                   \n\
{                                                                             \n\
FragColor = vec4(1.0, 0.0, 0.0, 1.0);                                     \n\
}";


static void RenderSceneCB()

{

    glClear(GL_COLOR_BUFFER_BIT);



    glEnableVertexAttribArray(0);

    glBindBuffer(GL_ARRAY_BUFFER, VBO);

    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);



    glDrawArrays(GL_TRIANGLES, 0, 3);



    glDisableVertexAttribArray(0);

    glfwSwapBuffers();

}




static void CreateVertexBuffer()

{

    Vector3f Vertices[3];

    Vertices[0] = Vector3f(-1.0f, -1.0f, 0.0f);

    Vertices[1] = Vector3f(1.0f, -1.0f, 0.0f);

    Vertices[2] = Vector3f(0.0f, 1.0f, 0.0f);



    glGenBuffers(1, &VBO);

glBindBuffer(GL_ARRAY_BUFFER, VBO);

glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);

}


static void AddShader(GLuint ShaderProgram, const char* pShaderText, GLenum ShaderType)

{

    GLuint ShaderObj = glCreateShader(ShaderType);



    if (ShaderObj == 0) {

        fprintf(stderr, "Error creating shader type %d\n", ShaderType);

        return ;

    }



    const GLchar* p[1];

    p[0] = pShaderText;

    GLint Lengths[1];

    Lengths[0]= strlen(pShaderText);

    glShaderSource(ShaderObj, 1, p, Lengths);

    glCompileShader(ShaderObj);

    GLint success;

    glGetShaderiv(ShaderObj, GL_COMPILE_STATUS, &success);

    if (!success) {

        GLchar InfoLog[1024];

        glGetShaderInfoLog(ShaderObj, 1024, NULL, InfoLog);

        fprintf(stderr, "Error compiling shader type %d: '%s'\n", ShaderType, InfoLog);

        return;

    }



    glAttachShader(ShaderProgram, ShaderObj);

}


static void CompileShaders()

{

    GLuint ShaderProgram = glCreateProgram();



    if (ShaderProgram == 0) {

        fprintf(stderr, "Error creating shader program\n");

        return;

    }



    AddShader(ShaderProgram, pVS, GL_VERTEX_SHADER);

    AddShader(ShaderProgram, pFS, GL_FRAGMENT_SHADER);



    GLint Success = 0;

    GLchar ErrorLog[1024] = { 0 };



    glLinkProgram(ShaderProgram);

    glGetProgramiv(ShaderProgram, GL_LINK_STATUS, &Success);

if (Success == 0) {

glGetProgramInfoLog(ShaderProgram, sizeof(ErrorLog), NULL, ErrorLog);

fprintf(stderr, "Error linking shader program: '%s'\n", ErrorLog);

        return;

}



    glValidateProgram(ShaderProgram);

    glGetProgramiv(ShaderProgram, GL_VALIDATE_STATUS, &Success);

    if (!Success) {

        glGetProgramInfoLog(ShaderProgram, sizeof(ErrorLog), NULL, ErrorLog);

        fprintf(stderr, "Invalid shader program: '%s'\n", ErrorLog);

        return;

    }



    glUseProgram(ShaderProgram);

}


int main(int argc, char** argv)

{

    glfwInit();

    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);

    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2);

    glfwOpenWindow(600, 600, 0, 0, 0, 0, 0, 0, GLFW_WINDOW);




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



    CreateVertexBuffer();



    CompileShaders();



   while (1)

   {

       RenderSceneCB();

   }



    return 0;

}

EDIT 2: And here the math_3d.h header

#ifndef MATH_3D_H
#define MATH_3D_H


struct Vector3f
{
    float x;
    float y;
    float z;

    Vector3f()
    {
    }

    Vector3f(float _x, float _y, float _z)
    {
        x = _x;
        y = _y;
        z = _z;
    }
};

#endif  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:47:07+00:00Added an answer on June 9, 2026 at 4:47 pm

    The problem is spelled out pretty clearly on the OpenGL Wiki’s Getting Started page. Your problem is that you don’t have a mechanism to load OpenGL functions, which is a necessary step in using OpenGL. You are strongly encouraged to use a library to do that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to loop through a bunch of documents I have to put
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.