compilation depuis xdarwin

blackhole

Membre actif
20 Avril 2002
434
0
Visiter le site
J'ai compiler un petit prog qui vient du monde linux (pas celui qui traine dans la gamezone).... avec les package de xdarwin.... mais ça me colle une erreur:

g++ -Wall -O3 -I/usr/X11R6/include -lGL -L/usr/X11R6/lib -o img main.o raster.o glwindow.o
ld: glwindow.o illegal reference to symbol: _XCloseDisplay defined in indirectly referenced dynamic library /usr/X11R6/lib/libX11.6.dylib
make: *** Error 1


avec comme package glwindow.cpp :

#include "glwindow.h"

GLWindow::~GLWindow() {
XDestroyWindow(dpy, win);
XCloseDisplay(dpy);
}

GLWindow::GLWindow() {

cout << "initializing X multithreading :\t"<<((XInitThreads())?"successful":"failed")<<endl;
RGB_COLOR = 3;


swap_flag = false;
int attributeListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER, /*In case single buffering is not supported*/ GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, None };
int attributeListSgl[] = { GLX_RGBA, GLX_RED_SIZE, 1, /*get the deepest buffer with 1 red bit*/ GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, None };

/* get a connection */
dpy = XOpenDisplay(0);

/* get an appropriate visual */
vi = glXChooseVisual(dpy, DefaultScreen(dpy), attributeListSgl);
if (vi == NULL) {
vi = glXChooseVisual(dpy, DefaultScreen(dpy), attributeListDbl);
swap_flag = true;
}
/* create a GLX context */
cx = glXCreateContext(dpy, vi, 0, GL_TRUE);

/* create a color map */
cmap = XCreateColormap(dpy, RootWindow(dpy, vi->screen), vi->visual, AllocNone);

/* create a window */
swa.colormap = cmap;
swa.border_pixel = 0;
swa.event_mask = StructureNotifyMask;
win = XCreateWindow(dpy, RootWindow(dpy, vi->screen),
0, 0, screen_width, screen_height,
0, vi->depth, InputOutput,
vi->visual,
CWBorderPixel|CWColormap|CWEventMask, &swa);
XMapWindow(dpy, win);
//XIfEvent(dpy, &event, WaitForNotify, (char*)win);
glXMakeCurrent(dpy, win, cx);


cout << "window created"<<endl;
}


void GLWindow::setRaster(Raster * in) {
R = in;
}


void GLWindow::idleLoop() {
while(true) display();
}


void GLWindow::display() {
// cout << "glwindow: display"<<endl;
glClearColor(0,0,0,0);
glClear(GL_COLOR_BUFFER_BIT);
R->update();
R->display();

swapBuffers();
}

void GLWindow::swapBuffers() {
if (swap_flag) glXSwapBuffers(dpy,win);
}


si qqun a une idée je suis preneur