Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [Solved] Problems about Integrating SFML 2.0 to Qt 4.7.4(Ubuntu 13)  (Read 2626 times)

0 Members and 1 Guest are viewing this topic.

ccleung6

  • Newbie
  • *
  • Posts: 22
    • View Profile
I follow this tutorial 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.
« Last Edit: December 15, 2013, 11:36:19 am by ccleung6 »

ccleung6

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Problems about Integrating SFML 2.0 to Qt 4.7.4(Ubuntu 13)
« Reply #1 on: December 15, 2013, 11:35:35 am »
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!!

 

anything