Results 1 to 7 of 7

Thread: I need help with my first attempt at a c++ prog with opengl...

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2000
    Location
    Hanmer
    Posts
    25

    I need help with my first attempt at a c++ prog with opengl...

    Here's my code:
    #include <windows.h>
    #include <gl/glut.h>

    void RenderScene(void)
    {
    glClear(GL_COLOR_BUFFER_BIT);

    glFlush();
    }
    void SetupRC(void)
    {
    glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
    }
    void main(void)
    {
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutCreateWindow("Simple");
    glutDisplayFunc(RenderScene);

    SetupRC();

    glutMainLoop();
    }
    Here's the error message:
    unresolved external '....'

    i bought the opengl superbible and it has all the glut files on them.There's no self-extracting archive...
    what files do i need to install and where do i install them?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: I need help with my first attempt at a c++ prog with opengl...

    I can't help you unless you tell me exactly (more or less) what the errormessage is saying. It's pretty obvious that you are missing a library file, but I can't tell which. In the errormessage it should say what function it couldn't find, and from there I (we) might be able to tell what library file is missing. ANd by the way, what platform/compiler are you using?

  3. #3
    Member Contributor
    Join Date
    Jun 2000
    Posts
    67

    Re: I need help with my first attempt at a c++ prog with opengl...

    If you got to Project->Settings from the menu...

    Then go to the Link tab..

    You may have to add in the OpenGL libs to the Project Options window...right now one of my projects contains things like:

    kernel32.lib user32.lib gdi32.lib

    So, you may also have to add these into the list of libraries for the link process:

    opengl32.lib glu32.lib

    Hope that helps!

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: I need help with my first attempt at a c++ prog with opengl...

    Just a note. In MSVC (at least, maybe other compilers too), gl*.lib is included automaticaly from <gl/glut.h>.

    In the beginning of the file:
    Code :
    #pragma comment (lib, "winmm.lib")     /* link with Windows MultiMedia lib */
    #pragma comment (lib, "opengl32.lib")  /* link with Microsoft OpenGL lib */
    #pragma comment (lib, "glu32.lib")     /* link with OpenGL Utility lib */
    #pragma comment (lib, "glut32.lib")    /* link with Win32 GLUT lib */

  5. #5
    Junior Member Newbie
    Join Date
    Jun 2000
    Location
    Hanmer
    Posts
    25

    Re: I need help with my first attempt at a c++ prog with opengl...

    Thanx alot peeps for your replies!!! I have posted a new message and have included more information. I NEED MENTAL HELP....

    Y-T
    P.S My washout dye has been in my hair for over a year. maybe if i took a shower once in a while...but i live in canada so it's not my fault the lakes are frozen!!!

  6. #6
    Member Contributor
    Join Date
    May 2000
    Location
    Ottawa, Ontario, Canada
    Posts
    75

    Re: I need help with my first attempt at a c++ prog with opengl...

    This is probably stupid and wrong but don't you need to include the gl.h file also? For glFlush, for example. Plus the lakes have all thawed in my part of Canada.

  7. #7
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: I need help with my first attempt at a c++ prog with opengl...

    Can post another part of <gl/glut.h> too.

    Code :
    #include <GL/gl.h>
    #include <GL/glu.h>
    And if that wasn't enough, since <gl/gl.h> needs <windows.h> (or actually just APIENTRY and WINGDIAPI), it's also included automatically

    In other words, you only have to include <gl/glut.h>

Similar Threads

  1. Only 2D works.... my 2nd attempt at opengl
    By beakie in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 08-26-2012, 07:51 AM
  2. Why OpenGL use in my prog. left coordinate system
    By xpear in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 07-13-2010, 06:19 PM
  3. opengl 3d prog
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-03-2005, 05:35 PM
  4. importing maya models into opengl prog.
    By llester in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 01-23-2003, 07:13 AM
  5. Easy OpenGL Prog, don't run
    By Frashman in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 06-08-2001, 08:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean