Results 1 to 3 of 3

Thread: Why my code can not be compiled :(

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2005
    Posts
    1

    Why my code can not be compiled :(

    my code is at below:

    /********************************************/
    #include <GL/glut.h>
    #include <GL/glu.h>
    #include <GL/gl.h>
    #include <windows.h>

    main()
    {
    InitializeAWindowPlease();

    glClearColor(0.0, 0.0, 0.0, 0.0);
    glClear(GL_COLOR_BUFFER_BIT);
    glColor3f(1.0, 1.0, 1.0);
    glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
    glBegin(GL_POLYGON);
    glVertex3f(0.25, 0.25, 0.0);
    glVertex3f(0.75, 0.25, 0.0);
    glVertex3f(0.75, 0.75, 0.0);
    glVertex3f(0.25, 0.75, 0.0);
    glEnd();
    glFlush();
    UpdateTheWindowAndCheckForEvents();
    }
    /***********************************************/

    When I build that.. there would be 4 errors:

    1.
    test_one.obj : error LNK2001: unresolved external symbol _UpdateTheWindowAndCheckForEvents

    2.
    test_one.obj : error LNK2001: unresolved external symbol _InitializeAWindowPlease

    3.
    LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16

    4.
    Debug/test_one.exe : fatal error LNK1120: 3 unresolved externals

    please help me...why such errors are there.....

    Thanks!

  2. #2
    Member Contributor
    Join Date
    Jan 2005
    Location
    Karachi, Pakistan
    Posts
    85

    Re: Why my code can not be compiled :(

    Originally posted by Marco2005:
    my code is at below:

    /********************************************/
    #include <GL/glut.h>
    #include <GL/glu.h>
    #include <GL/gl.h>
    #include <windows.h>

    main()
    {
    InitializeAWindowPlease();

    glClearColor(0.0, 0.0, 0.0, 0.0);
    glClear(GL_COLOR_BUFFER_BIT);
    glColor3f(1.0, 1.0, 1.0);
    glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
    glBegin(GL_POLYGON);
    glVertex3f(0.25, 0.25, 0.0);
    glVertex3f(0.75, 0.25, 0.0);
    glVertex3f(0.75, 0.75, 0.0);
    glVertex3f(0.25, 0.75, 0.0);
    glEnd();
    glFlush();
    UpdateTheWindowAndCheckForEvents();
    }
    /***********************************************/

    When I build that.. there would be 4 errors:

    1.
    test_one.obj : error LNK2001: unresolved external symbol _UpdateTheWindowAndCheckForEvents

    2.
    test_one.obj : error LNK2001: unresolved external symbol _InitializeAWindowPlease

    3.
    LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16

    4.
    Debug/test_one.exe : fatal error LNK1120: 3 unresolved externals

    please help me...why such errors are there.....

    Thanks!
    Hello there,
    You have taken this code from the opengl programming guide presumably. There is no such function in opengl as InitializeAWindowPlease(); or UpdateTheWindowAndCheckForEvents(); These functions are given here as place holders. Depending upon your OS, you have to do the opening and closing of windows and other os related stuff in plavce of these place holders. If you use glut, window handling will be dealt with by glut itself otherwise you would have to give WinMain handler yourself. Have a look at nehe's turoials at http://www.nehe.gamedev.net or Nate robins turotials at http://www.xmission.com/~nate/opengl for help on this. Check both glut and win32 stuff. thanx

  3. #3
    Senior Member Regular Contributor
    Join Date
    Aug 2004
    Location
    Angers, France
    Posts
    245

    Re: Why my code can not be compiled :(

    Don't forget the programming guide, th is simply the best method to visualise how-to-render-a-thing/effect
    The .Product will make you .Believe

Similar Threads

  1. glm is not compiled by VS2012 with /clr
    By apetrovhrw in forum OpenGL: General
    Replies: 0
    Last Post: 12-12-2013, 01:36 PM
  2. can't get the project compiled
    By suzanne14 in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 04-17-2009, 11:41 PM
  3. error running compiled code
    By appoose in forum OpenGL: Linux
    Replies: 2
    Last Post: 08-27-2003, 04:50 PM
  4. error running compiled code
    By appoose in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 08-25-2003, 12:30 PM
  5. compiled vertex array - just released my code
    By JacekPoplawski in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 08-04-2002, 08:36 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