C error: Expected expression

Mark Brethen mark.brethen at gmail.com
Tue Nov 13 14:54:46 UTC 2018


Here’s the rest of the code block

/* CENTRY */
int APIENTRY 
glutExtensionSupported(const char *extension)
{
  static const GLubyte *extensions = NULL;
  const GLubyte *start;
  GLubyte *where, *terminator;

  /* Extension names should not have spaces. */
  where = (GLubyte *) strchr(extension, ' ');
  if (where || *extension == '\0')
    return 0;

  if (!extensions)
    extensions = glGetString(GL_EXTENSIONS);
  /* It takes a bit of care to be fool-proof about parsing the
     OpenGL extensions string.  Don't be fooled by sub-strings, 

     etc. */
  start = extensions;
  for (;;) {
    where = (GLubyte *) strstr((const char *) start, extension);
    if (!where)
      break;
    terminator = where + strlen(extension);
    if (where == start || *(where - 1) == ' ') {
      if (*terminator == ' ' || *terminator == '\0') {
        return 1;
      }
    }
    start = terminator;
  }
  return 0;
}

Perhaps a semicolon is needed? i.e.

int APIENTRY; 
glutExtensionSupported(const char *extension)

Mark Brethen
mark.brethen at gmail.com



> On Nov 13, 2018, at 8:11 AM, Joshua Root <jmr at macports.org> wrote:
> 
> On 2018-11-14 00:48 , Mark Brethen wrote:
>> Having patched calculix-cgx with the OpenGL framework, I’m now getting the following error when compiling glut:
>> 
>> :info:build /opt/local/bin/gcc-mp-5 -O2 -Wall -Wno-narrowing -I./ -I/usr/include -I../../libSNL/src -I../../glut-3.5/src -I/usr/X11/include    -c -o ../../glut-3.5/src/glut_ext.o ../../glut-3.5/src/glut_ext.c
>> :info:build ../../glut-3.5/src/glut_ext.c:16:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'glutExtensionSupported'
>> :info:build  glutExtensionSupported(const char *extension)
>> :info:build  ^
>> :info:build make: *** [../../glut-3.5/src/glut_ext.o] Error 1
>> 
>> what does this mean?
>> 
>> here’s line 14-17 in glut_ext.c:
>> 
>> /* CENTRY */
>> int APIENTRY 
>> glutExtensionSupported(const char *extension)
>> {
> 
> The compiler sees something that looks like invalid syntax. Is APIENTRY
> perhaps not defined as a macro?
> 
> - Josh

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20181113/ece85b48/attachment.html>


More information about the macports-dev mailing list