error: syntax error before "GtkGLArea"



Hi all,

When i tried to compile a GtkGLArea source, I encountered the following error.

mywindow.c: In function `init':
mywindow.c:39: warning: implicit declaration of function
`G_TYPE_CHECK_INSTANCE_CAST'
mywindow.c::39: error: syntax error before "GtkGLArea"
mywindow.c::39: error: syntax error before ')' token
mywindow.c:: At top level:
mywindow.c::48: error: syntax error before "return"


my code as follows:
#include <GL/gl.h> 
#include <gtk/gtk.h>
#include <gdk/gdk.h> 
#include <gtkgl/gdkgl.h> 
#include <gtk/gtkdrawingarea.h> 
#include <gtkgl/gtkglarea.h>

#include "main.h"



gint init(GtkWidget *widget)
{/* OpenGL functions can be called only if make_current returns true */
if (gtk_gl_area_make_current(GTK_GL_AREA(widget)))
    {
      glViewport(0,0, widget->allocation.width, widget->allocation.height);
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      glOrtho(0,100, 100,0, -1,1);
      glMatrixMode(GL_MODELVIEW);
      glLoadIdentity();
    }
  return TRUE;
}


Anyone can give an idea on what cause the errors?

Thanks.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]