As topic indicates, I run Fedora4, and use the Anjuta 1.2.2 to manage my programing.
I’ve tried to read other posts and follow the examples, but it just wont work.
I tried to compile the following…
#include<X11/Xlib.h>
#include<GL/glx.h>
#include<GL/glu.h>
Display *dpy = XOpenDisplay(NULL);
Window root = DefaultRootWindow(dpy);
GLint att[] = {GLX_RGBA, None};
XVisualInfo *vi = glXChooseVisual(dpy, 0, att);
GLXContext glc = glXCreateContext(dpy, vi, NULL, False);
Visual *vis = DefaultVisual(dpy, 0);
Colormap cmap = XCreateColormap(dpy, root, vis, AllocNone);
unsigned int w = XDisplayWidth(dpy, 0) / 2;
unsigned int h = XDisplayHeight(dpy, 0) / 2;
int dep = DefaultDepth(dpy, 0);
int cmask = CWColormap | CWBorderPixel | CWEventMask;
int emask = ExposureMask;
XEvent xev;
XSetWindowAttributes swa;
XWindowAttributes gwa;
Window win;
int main(int argc, char *argv[]){
swa.colormap = cmap;
swa.border_pixel = 0;
swa.event_mask = emask;
win = XCreateWindow(dpy, root, 0, 0, 400, 400, 0, dep, InputOutput, vis, cmask, &swa);
XStoreName(dpy, win, "SIMPLE GL QUAD");
XMapWindow(dpy, win);
glXMakeCurrent(dpy, win, glc);
glClearColor(0.00, 0.00, 0.60, 1.00);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1., 1., -1., 1., 1., 100.);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0., 0., 10., 0., 0., 0., 0., 1., 0.);
while(1) {
XNextEvent(dpy, &xev);
if(xev.type == Expose) {
XGetWindowAttributes(dpy, win, &gwa);
w = gwa.width;
h = gwa.height;
glViewport(0, 0, w, h);
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_QUADS);
glColor3f(1., 0., 0.); glVertex3f(-.75, -.75, 0.);
glColor3f(0., 1., 0.); glVertex3f( .75, -.75, 0.);
glColor3f(0., 0., 1.); glVertex3f( .75, .75, 0.);
glColor3f(1., 1., 0.); glVertex3f(-.75, .75, 0.);
glEnd();
glFlush(); } } }
//
// gcc -I/usr/X11R6/include/ -L/usr/X11R6/lib -o SimpleQuad SimpleQuad.cc -lX11 -lGL -lGLU
//
Then I get this :
Compiling file: main.c ...
gcc `glib-config --cflags` `gtk-config --cflags` `gnome-config --cflags glib gtk gnome gnomeui` `gnome-config --cflags glib gtk gnome gnomeui bonobo` `gtkmm-config --cflags` `gnome-config --cflags gnomemm` `libglade-config --cflags gnome` `wx-config --cxxflags` -c "main.c" -o "main.o"
sh: glib-config: command not found
sh: gtk-config: command not found
sh: gnome-config: command not found
sh: gnome-config: command not found
sh: gtkmm-config: command not found
sh: gnome-config: command not found
sh: libglade-config: command not found
sh: wx-config: command not found
main.c:1:21: error: X11/Xlib.h: No such file or directory
In file included from main.c:2:
/usr/include/GL/glx.h:26:23: error: X11/Xutil.h: No such file or directory
In file included from main.c:2:
/usr/include/GL/glx.h:139: error: syntax error before ‘GLXContextID’
/usr/include/GL/glx.h:140: error: syntax error before ‘GLXPixmap’
/usr/include/GL/glx.h:141: error: syntax error before ‘GLXDrawable’
/usr/include/GL/glx.h:142: error: syntax error before ‘GLXPbuffer’
/usr/include/GL/glx.h:143: error: syntax error before ‘GLXWindow’
/usr/include/GL/glx.h:144: error: syntax error before ‘GLXFBConfigID’
/usr/include/GL/glx.h:162: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:162: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:165: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:168: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:171: error: syntax error before ‘glXCreateGLXPixmap’
/usr/include/GL/glx.h:171: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:174: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:176: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:178: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:183: error: syntax error before ‘glXGetCurrentDrawable’
/usr/include/GL/glx.h:185: error: syntax error before ‘glXIsDirect’
/usr/include/GL/glx.h:185: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:187: error: syntax error before ‘glXMakeCurrent’
/usr/include/GL/glx.h:187: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:190: error: syntax error before ‘glXQueryExtension’
/usr/include/GL/glx.h:190: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:192: error: syntax error before ‘glXQueryVersion’
/usr/include/GL/glx.h:192: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:194: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:196: error: syntax error before ‘font’
/usr/include/GL/glx.h:208: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:210: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:212: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:221: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:229: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:232: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:236: error: syntax error before ‘glXCreatePbuffer’
/usr/include/GL/glx.h:236: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:239: error: syntax error before ‘glXCreatePixmap’
/usr/include/GL/glx.h:239: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:242: error: syntax error before ‘glXCreateWindow’
/usr/include/GL/glx.h:242: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:245: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:247: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:249: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:251: error: syntax error before ‘glXGetCurrentReadDrawable’
/usr/include/GL/glx.h:253: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:256: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:258: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:261: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:261: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:263: error: syntax error before ‘glXMakeContextCurrent’
/usr/include/GL/glx.h:263: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:266: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:269: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:272: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:275: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:276: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:277: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:278: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:278: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:279: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:279: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:279: error: ‘GLXWindow’ declared as function returning a function
/usr/include/GL/glx.h:279: error: ‘GLXWindow’ redeclared as different kind of symbol
/usr/include/GL/glx.h:143: error: previous declaration of ‘GLXWindow’ was here
/usr/include/GL/glx.h:280: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:281: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:281: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:281: error: ‘GLXPixmap’ declared as function returning a function
/usr/include/GL/glx.h:281: error: ‘GLXPixmap’ redeclared as different kind of symbol
/usr/include/GL/glx.h:140: error: previous declaration of ‘GLXPixmap’ was here
/usr/include/GL/glx.h:282: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:283: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:283: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:283: error: ‘GLXPbuffer’ declared as function returning a function
/usr/include/GL/glx.h:283: error: ‘GLXPbuffer’ redeclared as different kind of symbol
/usr/include/GL/glx.h:142: error: previous declaration of ‘GLXPbuffer’ was here
/usr/include/GL/glx.h:284: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:285: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:286: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:287: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:287: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:287: error: ‘Bool’ declared as function returning a function
/usr/include/GL/glx.h:288: error: syntax error before ‘*’ token
/usr/include/GL/glx.h:288: error: ‘GLXDrawable’ declared as function returning a function
/usr/include/GL/glx.h:288: error: ‘GLXDrawable’ redeclared as different kind of symbol
Completed ... unsuccessful
Total time taken: 0 secs