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: help me please

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2004
    Posts
    3

    help me please

    I am a newb to opengl and having problems. I have included glut32.lib glu32.lib opengl32.lib glaux.lib and libglut32.a in the Object/Library Modules for the linker
    but i still get errors when i compiled anything containg opengl.

    Example:
    #include <GL/glut.h>

    #include <stdlib.h>

    void init(void)

    {

    glClearColor (0.0, 0.0, 0.0, 0.0);

    glShadeModel (GL_FLAT);

    }

    void display(void)

    {

    glClear (GL_COLOR_BUFFER_BIT);

    glColor3f (1.0, 1.0, 1.0);

    glLoadIdentity ();



    gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);

    glScalef (1.0, 2.0, 1.0);

    glutWireCube (1.0);

    glFlush ();

    }

    void reshape (int w, int h)

    {

    glViewport (0, 0, (GLsizei) w, (GLsizei) h);

    glMatrixMode (GL_PROJECTION);

    glLoadIdentity ();

    glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);

    glMatrixMode (GL_MODELVIEW);

    }

    void keyboard(unsigned char key, int x, int y)

    {

    switch (key) {

    case 27:

    exit(0);

    break;

    }

    }

    int main(int argc, char** argv)

    {

    glutInit(&argc, argv);

    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);

    glutInitWindowSize (500, 500);

    glutInitWindowPosition (100, 100);

    glutCreateWindow (argv[0]);

    init ();

    glutDisplayFunc(display);

    glutReshapeFunc(reshape);

    glutKeyboardFunc(keyboard);

    glutMainLoop();

    return 0;

    }

    I get these errors

    --------------------Configuration: Opengl - Win32 Debug--------------------
    Linking...
    Cube.obj : error LNK2001: unresolved external symbol ___glutInitWithExit@12
    Cube.obj : error LNK2001: unresolved external symbol ___glutCreateWindowWithExit@8
    LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
    Debug/Opengl.exe : fatal error LNK1120: 3 unresolved externals
    Error executing link.exe.

    Opengl.exe - 4 error(s), 0 warning(s)

    Whats wrong? thanks for your time

  2. #2
    Advanced Member Frequent Contributor marcus256's Avatar
    Join Date
    Aug 2001
    Location
    Sweden
    Posts
    853

    Re: help me please

    This has to do with the GLUT "atexit hack". I think you can define GLUT_DISABLE_ATEXIT_HACK (or similar). Check the glut.h file and you will probably find it. (then do #define GLUT_DISABLE_ATEXIT_HACK in your program before including glut.h).

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2004
    Posts
    3

    Re: help me please

    Sorry for wasting ur time imma real newb thanks :-)

Posting Permissions

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