new to opengl

This is a discussion on new to opengl within the Game Programming forums, part of the General Programming Boards category; i keep getting missing prototype for glEnd and missing prototype of glflush then poissible usage of GL_POLYGON(GL_BUFFER_BIT) i use icc ...

  1. #1
    Registered User
    Join Date
    Oct 2006
    Location
    New York
    Posts
    121

    new to opengl

    i keep getting missing prototype for glEnd
    and missing prototype of glflush
    then poissible usage of GL_POLYGON(GL_BUFFER_BIT)
    i use icc compiler

    Code:
     #include<gl\gl.h>
      #include<gl\glu.h>
      #include<gl\glaux.h>
    
       main() {
       glClearColor(0.0, 0.0, 0.0, 0.0);
       glClear(GL_COLOR_BUFFER_BIT);
       glColor3f(1.0, 1.0, 1.0);
       glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
       glBegin(GL_POLYGON);
          glVertex2f(-0.5, -0.5);
          glVertex2f(-0.5, 0.5);
          glVertex2f(0.5, 0.5);
          glVertex2f(0.5, -0.5);
       glEnd();
       glFlush();
                         }
    Last edited by Darkinyuasha1; 11-05-2006 at 08:03 AM.

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,045
    Missing prototype or undefined reference? glEnd() appears to be in one of your first two header files. If you're getting a missing prototype or implicit int warning, then there might be something wrong with your header file (like maybe the compiler can't find it). For an undefined reference (linker error), you need to link with the proper libraries.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,333
    > #include<gl\gl.h>
    The usual convention is to use /, not \

    > main()
    main returns an int.
    Your main does return an int, but you're relying on the obsolete behaviour of 'C' which makes everything an int. It's best to learn to be specific.

    Also, was it necessary to clip off the closing brace for main when you copy/pasted the code?

    You might get a better answer if you posted actual error messages.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Oct 2006
    Location
    New York
    Posts
    121
    these are the errors i get

    c:\lcc\game.c:1 Could not find include file <gl/gl.h>
    c:\lcc\game.c:2 Could not find include file <gl/glu.h>
    c:\lcc\game.c:3 Could not find include file <gl/glaux.h>
    warning c:\lcc\game.c:2 no type specified. defaulting to int
    warning c:\lcc\game.c: 3 missing prototype for glClearColor
    warning c:\lcc\game.c: 3 missing prototype for 'glClearColor'
    then after that it basically says it for the others too soo i did make the type specified but how do you link theh files on an icc compiler???

  5. #5
    Registered User
    Join Date
    Oct 2006
    Location
    New York
    Posts
    121
    ok i put the gl.h,glaux.h,and glu.h headers in the right places and the library but i get an error

    warning c:\icc\game.c:\icc\include\gl\gl.h: 1135 no type specified. defaulting to int

    error c:\icc\game.c: c:\icc\include\gl.gl.h: 1135 syntax error; missing semicolon before 'void'

    error c:\icc\game.c: c:\Icc\include\gl.gl.h: 1135 syntax error; missing semicolon before 'glAccum'

    warning c:\icc\game.c:\icc\include\gl\gl.h: 11356 no ype specified. defaulting to int
    error c:\icc\game.c: c:\icc\include\gl.gl.h: 1136syntax error; missing semicolon before 'void'
    error c:\icc\game.c: c:\icc\include\gl.gl.h: 1136syntax error; missing semicolon before 'glAlphafunc'
    then it has an error for 1142 and 1143

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,333
    With gcc, it would be
    gcc -I/path/to/opengl prog.c

    The -I option tells the compile the name of a directory containing .h files.
    The actual pathname to be included would be
    /path/to/opengl/gl/gl.h

    Now the exact command line option for your compiler is something you'll have to look up (it's the one which specifies additional include directories). And of course you need to substitute the path to where you installed the openGL stuff on your machine.

    That's half the story.

    The other part is telling the linker where the actual library code is.
    With gcc, we may do
    gcc -I/path/to/opengl prog.c -L/path/to/opengl/lib -lopengl
    Where the -L option tells us where the library is, and the -l option tells us the name of the library.

    Of course, you need to look up the actual names of your libraries, and perhaps make sure that the libraries are in a format understood by your compiler.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  7. #7
    Registered User
    Join Date
    Oct 2006
    Location
    New York
    Posts
    121
    >.> i did the header and lib but there is errors in gl.h >.>

  8. #8
    Registered User
    Join Date
    Oct 2006
    Location
    New York
    Posts
    121
    ok, to start off of what i did. Instead of linking i put the library files into the lib directory..then I try to test my #includes.... when i compile it gives offf

    warning c:\icc\game.c:\icc\include\gl\gl.h: 1135 no type specified. defaulting to int

    error c:\icc\game.c: c:\icc\include\gl.gl.h: 1135 syntax error; missing semicolon before 'void'

    error c:\icc\game.c: c:\Icc\include\gl.gl.h: 1135 syntax error; missing semicolon before 'glAccum'

    warning c:\icc\game.c:\icc\include\gl\gl.h: 11356 no ype specified. defaulting to int
    error c:\icc\game.c: c:\icc\include\gl.gl.h: 1136syntax error; missing semicolon before 'void'
    error c:\icc\game.c: c:\icc\include\gl.gl.h: 1136syntax error; missing semicolon before 'glAlphafunc'
    then it has an error for 1142 and 1143

  9. #9
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    With lcc did you create a windows application project? If not, start over.

    Have you read any beginner tutorials/texts on opengl programming? If not do so now because if the code you posted in your first post is the entirety of your code then it's never going to do anything.

    The reason for your errors is because you haven't included windows.h but it's no going to do much more than eliminate some errors if you were to do so with that code.

    To get started with opengl programming check out the sticky thread at the top of this board ie. Game programming links.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  2. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  3. OpenGL .dll vs video card dll
    By Silvercord in forum Game Programming
    Replies: 14
    Last Post: 02-12-2003, 06:57 PM
  4. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 09:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21