Subject: opengl, glut, and many syntax errors
From: [email-masked]

17 Feb 1998 05:40:15 -0800
Message-ID: <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7Bit
To: [email-masked]

I'm trying to compile a c++ program that uses the header files
    glut.h
    glu.h
    gl.h
I am using the gcc compiler that came with the gnuwin32 cdk package.
When I try to compile a program using the following command at the dos prompt
    gcc (filename) -lstdc++ -lglut32 -lopengl32 -lglu32
I get a lot of syntax errors such as the following...

In file included from 
C:\\gnuwin32\\b18\\H-i386-cygwin32\\lib\\gcc-lib\\i386-cygwin32\\cygnus-2.7.2-9
70404\\../../../../i386-cygwin32/include/gl\\glut.h:14,
                 from pc5d.cc:59:
C:\\gnuwin32\\b18\\H-i386-cygwin32\\lib\\gcc-lib\\i386-cygwin32\\cygnus-2.7.2-9
70404\\../../../../i386-cygwin32/include/GL/gl.h:1135: syntax error before 
`void'
C:\\gnuwin32\\b18\\H-i386-cygwin32\\lib\\gcc-lib\\i386-cygwin32\\cygnus-2.7.2-9
70404\\../../../../i386-cygwin32/include/GL/gl.h:1473: syntax error before `*'

,etc.

These syntax errors occur in lines in gl.h and glu.h that has the word
"APIENTRY" in them.  For example....
     WINGDIAPI void APIENTRY glAccum (GLenum op, GLfloat value);
(from line 1135 in gl.h)

I think that the problem may be in the following lines of code in the glut.h 
header.

#ifndef __glut_h__
#define __glut_h__

#if defined(WIN32)
#include <windows.h>
#pragma warning (disable:4244)	/* disable bogus conversion warnings */
#endif
#include <GL/gl.h>
#include <GL/glu.h>

/* define APIENTRY and CALLBACK to null string if we aren't on Win32 */
#if !defined(WIN32)
#define APIENTRY
#define CALLBACK
#endif

I suspect that the compiler is evaluating the line "#if defined(WIN32)" as 
being false, but I don't know how to confirm this, and I wouldn't know what to 
do about it if this were the case.  Can anyone tell me if I'm on the right 
track, or if it is even possible to get compile opengl programs (with glut 
utilities--glut.h) with this version of the gcc compiler.

Any help would be appreciated,
Lee Morgan
[email-masked]

P.S. I'm sure that the libraries and header files are in the correct 
directories.

P.P.S.  I read the mail in the Dec 1997 archives regarding 
Re: g++, opengl, and STDCALL, * __attribute__ ((stdcall)) problem. Colin Peters 
Re: g++, opengl, and STDCALL, * __attribute__ ((stdcall)) problem. Ulisses T. 
Mello 
These suggestions did not get rid of my syntax errors.  In some cases it just 
moved the error to another point in the line.
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".