I follow this tutorial http://sfml-dev.org/tutorials/1.6/graphics-qt.php (http://sfml-dev.org/tutorials/1.6/graphics-qt.php) to integrate SFML 2.0 to Qt on Ubuntu 13.10.
But this code cannot be compiled:
#ifdef Q_WS_X11
XFlush(QX11Info::display());
#endif
Error message are:
error: incomplete type 'QX11Info' used in nested name specifier
error: 'XFlush' was not declared in this scope
I have included as the tutorial does.
#ifdef Q_WS_X11
#include <Qt/qx11info_x11.h>
#include <X11/Xlib.h>
#endif
If I comment out this XFlush(QX11Info::display());, it can compile but nothing is displayed on Qt window and give this error message in appplication output:
Failed to activate the window's context
Any idea about this problem? How to fix it?
Thanks.
I have figure out what's wrong.
The X11 headers should be included after SFML header
#ifdef Q_WS_X11
#include <Qt/qx11info_x11.h>
#include <X11/Xlib.h>
#endif
And .pro should add
LIBS += -lX11
It is OK now.
Happy Coding!!