Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Compilation problems of trivial code on Windows 7

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2012
    Posts
    3

    Compilation problems of trivial code on Windows 7

    I am trying to compile a very basic OpenGL program that draws a cube using Vertex Array Buffers passed to vertex & fragment shaders

    My code is tested & runs perfectly on OSX, however it does not compile on Windows 7 machine. I have the nVidia GeForce 540M chipset and have updated my drivers to the latest

    I import the necessary headers using:
    Code :
    #ifdef _WIN32
    #include <Windows.h>
    #endif
     
    #include <stdlib.h>
    #include <stdio.h>
    #ifdef __APPLE__
    #include <OpenGL/gl.h>
    #include <Glut/glut.h>
    #else
    #include <GL/gl.h>
    #include <GL/glut.h>
    #endif

    however, I get compilation errors in Visual C++ 2010 express saying: ERROR: identifer 'xyz' is undefined, where xyz is one of:
    Code :
    glCreateProgram(), GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, glAttachShader, glLinkProgram
    and others. stuff like
    Code :
    glClearColor, glEnable, glBlendFunc
    however is fine and has no compilation errors.

    So, why are these symbols undefined? what imports am I missing / doing wrong?

    HERE is a complete paste of my code if it would help at all. The includes are in the "shaderUtilities.h" file

    Thanks for your help in advance

    Disclaimer: complete newbie here, so please forgive my ignorance if this is the wrong place to post. Also, I have searched for a similar issue, but could not find one, so if this is indeed a repeated question, please forgive me and kindly redirect me to what I should read / search for

  2. #2
    Intern Contributor
    Join Date
    Jul 2006
    Posts
    72
    You are missing headers and probably are not loading any of the functions you attempt to use, read:
    http://www.opengl.org/wiki/Getting_S...ting_Functions

    I recommend you use a loading library:
    http://www.opengl.org/wiki/OpenGL_Loading_Library

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2012
    Posts
    3
    Quote Originally Posted by tanzanite View Post
    You are missing headers and probably are not loading any of the functions you attempt to use, read:
    http://www.opengl.org/wiki/Getting_S...ting_Functions

    I recommend you use a loading library:
    http://www.opengl.org/wiki/OpenGL_Loading_Library
    Thanks for the advice and for pointing me into the correct direction

    Could you explain why this is not needed on MacOSX though?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •