Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: C code working in Linux but not in Windows

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2004
    Location
    Australia
    Posts
    8

    C code working in Linux but not in Windows

    hey there
    i just loaded my C code i have been working on in linux into my home visual 6 studio and i cant get my code to compile
    i have set up the linking properly and it finds gl.h and the definition for typedef int GLint;
    but it says that 'GLint CirclePoints = 60;'
    is an illegal use of this type as an expression
    if anyone could help me that would be great

  2. #2
    Advanced Member Frequent Contributor plasmonster's Avatar
    Join Date
    Mar 2004
    Posts
    750

    Re: C code working in Linux but not in Windows

    I've never seen the like. Where is that expression located: GLint CirclePoints = 60 ?

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2004
    Location
    Australia
    Posts
    8

    Re: C code working in Linux but not in Windows

    #include <Gl\glut.h>
    #include <math.h>
    #define PI 3.14159
    void display(void)
    {
    int i = 0;
    float angle;
    /* clear window */
    glClear(GL_COLOR_BUFFER_BIT);
    GLint CirclePoints = 60;
    etc......
    if you need more info i can post the whole program..also i am a newbie at openGl so go easy

  4. #4
    Advanced Member Frequent Contributor plasmonster's Avatar
    Join Date
    Mar 2004
    Posts
    750

    Re: C code working in Linux but not in Windows

    I'll bet that your header is not visible from your source file.

  5. #5
    Advanced Member Frequent Contributor plasmonster's Avatar
    Join Date
    Mar 2004
    Posts
    750

    Re: C code working in Linux but not in Windows

    Don't forget this:
    #include <GL/gl.h>

  6. #6
    Junior Member Newbie
    Join Date
    Apr 2004
    Location
    Australia
    Posts
    8

    Re: C code working in Linux but not in Windows

    hey there portal
    i loaded my code onto a web page because i still cant get it working
    have a look at it at www.geocities.com/bernief_1982/index.html
    cheers

  7. #7
    Advanced Member Frequent Contributor plasmonster's Avatar
    Join Date
    Mar 2004
    Posts
    750

    Re: C code working in Linux but not in Windows

    If the compiler is complaining about an undefined type, then you know what the problem is: it can't see the header - it's that simple.
    GLint, and all the other basic GL types are defined in gl.h.

    edit:
    try this:
    #include <windows.h>
    #include <GL\gl.h>
    #include <GL\glut.h>

  8. #8
    Junior Member Newbie
    Join Date
    Apr 2004
    Location
    Australia
    Posts
    8

    Re: C code working in Linux but not in Windows

    the compiler is just complaining about an illegal use of the type
    it finds the definition in gl.h fine but still doesnt like the code
    thats the problem im having

  9. #9
    Advanced Member Frequent Contributor plasmonster's Avatar
    Join Date
    Mar 2004
    Posts
    750

    Re: C code working in Linux but not in Windows

    Bernie_82, if there's something wrong with your code, it's not immediately obvious to me what it is. What exactly is the compiler telling you?

  10. #10
    Junior Member Newbie
    Join Date
    Apr 2004
    Location
    Australia
    Posts
    8

    Re: C code working in Linux but not in Windows

    This is exactly what its telling me.
    You can see how it finds the declaration of GLint
    thats why i find it weird that it wont work

    C:\main.c(13) : error C2275: 'GLint' : illegal use of this type as an expression

    d:\program files\microsoft visual studio\vc98\include\gl\gl.h(48) : see declaration of 'GLint'

    C:\main.c(13) : error C2146: syntax error : missing ';' before identifier 'CirclePoints'

    C:\main.c(13) : error C2065: 'CirclePoints' : undeclared identifier

Posting Permissions

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