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

Author Topic: Qt + SFML  (Read 10231 times)

0 Members and 1 Guest are viewing this topic.

Fellow Traveler

  • Newbie
  • *
  • Posts: 5
    • View Profile
Qt + SFML
« on: January 04, 2010, 03:41:25 pm »
I have Windows + Qt. I downloaded Windows - MinGW version

I tried this example:
http://www.sfml-dev.org/tutorials/1.5/graphics-qt.php

And still don't get, how to make work SFML on Qt.
I copied SFML headers files in Include directory of Qt. And here my .pro file:

Quote

HEADERS += QSFMLCanvas.hpp
SOURCES += QSFMLCanvas.cpp \
    graphics-qt.cpp
LIBS += H:\libs\SFML-1.5\lib\mingw\libsfml-graphics.a \
H:\libs\SFML-1.5\lib\mingw\libsfml-main.a \
H:\libs\SFML-1.5\lib\mingw\libsfml-system.a \
H:\libs\SFML-1.5\lib\mingw\libsfml-window.a


When I trying to make project i get link errors.
What i am doing wrong?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Qt + SFML
« Reply #1 on: January 04, 2010, 04:11:33 pm »
Quote
When I trying to make project i get link errors.

Which ones?
Laurent Gomila - SFML developer

Fellow Traveler

  • Newbie
  • *
  • Posts: 5
    • View Profile
Qt + SFML
« Reply #2 on: January 04, 2010, 04:51:44 pm »
like this:
Quote
F:/my/Programming/qt/SFML/QSFMLCanvas.cpp:17: undefined reference to `__gxx_personality_sj0'
F:/my/Programming/qt/SFML/QSFMLCanvas.cpp:17: undefined reference to `_Unwind_SjLj_Register'
F:/my/Programming/qt/SFML/QSFMLCanvas.cpp:34: undefined reference to `_Unwind_SjLj_Resume'
F:/my/Programming/qt/SFML/QSFMLCanvas.cpp:34: undefined reference to `_Unwind_SjLj_Unregister'
C:/Qt/2009.03/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_tree.h:(.text$_ZN8MyCanvas6OnInitEv[MyCanvas::OnInit:-1: error: undefined reference to `__gxx_personality_sj0'
C:/Qt/2009.03/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_tree.h:(.text$_ZN8MyCanvas6OnInitEv[MyCanvas::OnInit:-1: error: undefined reference to `_Unwind_SjLj_Register'
C:/Qt/2009.03/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_tree.h:(.text$_ZN8MyCanvasD1Ev[MyCanvas::~MyCanvas:-1: error: undefined reference to `_Unwind_SjLj_Resume'

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Qt + SFML
« Reply #3 on: January 04, 2010, 07:10:34 pm »
Are you sure that you use g++ and not gcc?
Laurent Gomila - SFML developer

Fellow Traveler

  • Newbie
  • *
  • Posts: 5
    • View Profile
Qt + SFML
« Reply #4 on: January 04, 2010, 08:03:37 pm »
i use g++. Here is the keys:
Quote
C:/Qt/2009.05/mingw/bin/mingw32-make.exe -w
mingw32-make: Entering directory `F:/my/Programming/qt/SFML'
C:/Qt/2009.05/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `F:/my/Programming/qt/SFML'
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug/SFML.exe debug/QSFMLCanvas.o debug/graphics-qt.o -L'c:/Qt/2009.05/qt/lib' -lmingw32 -lqtmaind H:\libs\SFML-1.5\lib\mingw\libsfml-graphics-s-d.a H:\libs\SFML-1.5\lib\mingw\libsfml-main-d.a H:\libs\SFML-1.5\lib\mingw\libsfml-system-s-d.a H:\libs\SFML-1.5\lib\mingw\libsfml-window-s-d.a -lQtGuid4 -lQtCored4
mingw32-make[1]: Leaving directory `F:/my/Programming/qt/SFML'


I changed library to debug, i got warning like this:
Quote
F:/my/Programming/qt/SFML/QSFMLCanvas.cpp:17: undefined reference to `__gxx_personality_sj0'


and errors like this:
Quote
C:/Qt/2009.03/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_tree.h:(.text$_ZN8MyCanvas6OnInitEv[MyCanvas::OnInit:-1: error: undefined reference to `__gxx_personality_sj0'

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Qt + SFML
« Reply #5 on: January 05, 2010, 12:06:33 pm »
This is the link command line, what about the command line that compiles your cpp files into .o?
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Qt + SFML
« Reply #6 on: January 05, 2010, 02:30:05 pm »
Are you using gcc 4.4.0?
Laurent Gomila - SFML developer

Fellow Traveler

  • Newbie
  • *
  • Posts: 5
    • View Profile
Qt + SFML
« Reply #7 on: January 05, 2010, 08:30:21 pm »
sorry, actually i use QtCreator i didn't worry about paramethers.

Quote
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I'c:/Qt/2009.05/qt/include/QtCore' -I'c:/Qt/2009.05/qt/include/QtGui' -I'c:/Qt/2009.05/qt/include' -I'c:/Qt/2009.05/qt/include/ActiveQt' -I'debug' -I'c:/Qt/2009.05/qt/mkspecs/win32-g++' -o debug/QSFMLCanvas.o QSFMLCanvas.cpp
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I'c:/Qt/2009.05/qt/include/QtCore' -I'c:/Qt/2009.05/qt/include/QtGui' -I'c:/Qt/2009.05/qt/include' -I'c:/Qt/2009.05/qt/include/ActiveQt' -I'debug' -I'c:/Qt/2009.05/qt/mkspecs/win32-g++' -o debug/graphics-qt.o graphics-qt.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug/SFML.exe debug/QSFMLCanvas.o debug/graphics-qt.o -L'c:/Qt/2009.05/qt/lib' -lmingw32 -lqtmaind H:\libs\SFML-1.5\lib\mingw\libsfml-graphics-s-d.a H:\libs\SFML-1.5\lib\mingw\libsfml-main-d.a H:\libs\SFML-1.5\lib\mingw\libsfml-system-s-d.a H:\libs\SFML-1.5\lib\mingw\libsfml-window-s-d.a -lQtGuid4 -lQtCored4


after this i have 2 object files:
QSFMLCanvas.o
graphics-qt.o

there are really interesting errors like this:
Quote
H:\libs\SFML-1.5\lib\mingw\libsfml-graphics-s-d.a(RenderWindow.o): In function `ZN2sf12RenderWindowC2Ev':
D:/Programmation/Cpp/SFML/tags/1.5/src/SFML/Graphics/RenderWindow.cpp:41: undefined reference to `__gxx_personality_sj0'
D:/Programmation/Cpp/SFML/tags/1.5/src/SFML/Graphics/RenderWindow.cpp:41: undefined reference to `_Unwind_SjLj_Register'
D:/Programmation/Cpp/SFML/tags/1.5/src/SFML/Graphics/RenderWindow.cpp:41: undefined reference to `_Unwind_SjLj_Resume'
D:/Programmation/Cpp/SFML/tags/1.5/src/SFML/Graphics/RenderWindow.cpp:41: undefined reference to `_Unwind_SjLj_Unregister'
H:\libs\SFML-1.5\lib\mingw\libsfml-graphics-s-d.a(RenderWindow.o): In function `ZN2sf12RenderWindowC1Ev':
D:/Programmation/Cpp/SFML/tags/1.5/src/SFML/Graphics/RenderWindow.cpp:41: undefined reference to `__gxx_personality_sj0'
D:/Programmation/Cpp/SFML/tags/1.5/src/SFML/Graphics/RenderWindow.cpp:41: undefined reference to `_Unwind_SjLj_Register'
D:/Programmation/Cpp/SFML/tags/1.5/src/SFML/Graphics/RenderWindow.cpp:41: undefined reference to `_Unwind_SjLj_Resume'
D:/Programmation/Cpp/SFML/tags/1.5/src/SFML/Graphics/RenderWindow.cpp:41: undefined reference to `_Unwind_SjLj_Unregister'


I have not disk D and this folders at all.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Qt + SFML
« Reply #8 on: January 05, 2010, 08:46:54 pm »
Weird. What if you use static libraries?

Quote
I have not disk D and this folders at all.

These are the paths on my disk ;)
Laurent Gomila - SFML developer

Dravere

  • Newbie
  • *
  • Posts: 37
    • View Profile
Qt + SFML
« Reply #9 on: January 06, 2010, 12:28:43 am »
Hmmm, I probably know what the problem is, but I'm not so sure...

If I remember right Qt Creator uses the old GCC Compiler from MinGW on Windows. It is the version 3.4.5 or something. And I once read someting about problems between SJLJ and DW2 exception handling. You should have a look at the mingw.org Mailing List.

Or perhaps try this GCC (4.4.1) replacement for MinGW:
http://www.tdragon.net/recentgcc/

Dravere

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Qt + SFML
« Reply #10 on: January 06, 2010, 08:21:37 am »
Qt uses 4.4.x in its latest release, but anyway, SFML uses 3.4.5 too. A french user having the same problem tried to recompile SFML with gcc 4.4.0, and he's got the same problems.
Laurent Gomila - SFML developer

Fellow Traveler

  • Newbie
  • *
  • Posts: 5
    • View Profile
Qt + SFML
« Reply #11 on: January 06, 2010, 11:35:38 am »
Quote
If I remember right Qt Creator uses the old GCC Compiler from MinGW on Windows. It is the version 3.4.5 or something. And I once read someting about problems between SJLJ and DW2 exception handling. You should have a look at the mingw.org Mailing List.


no, its one of latest release of Qt, and in manifest of Mingw said, what it is gcc 4.40....hm

Quote
Weird. What if you use static libraries?

I think i missed something. I used static libraries. I changed it to "-d.a", now project builds normal. But then i starts it, it crashes:

Quote
Lauching F:\my\Programming\qt\SFML\debug\SFML.exe...
F:\my\Programming\qt\SFML\debug\SFML.exe ends with code -1073741515

Dravere

  • Newbie
  • *
  • Posts: 37
    • View Profile
Qt + SFML
« Reply #12 on: January 06, 2010, 11:43:05 am »
Quote from: "Laurent"
Qt uses 4.4.x in its latest release, ...
Quote from: "Fellow Traveler"
no, its one of latest release of Qt, and in manifest of Mingw said, what it is gcc 4.40....hm

Interesting ...
How is this possible, because MinGW has no stable GCC 4.4 release yet, as far as I know. There seems only to be a beta somewhere, which I never could find :?

Well anyway, sorry I couldn't help. Currently don't have a functioning GCC setup here to test it.

Dravere

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Qt + SFML
« Reply #13 on: January 06, 2010, 12:42:12 pm »
Quote
How is this possible, because MinGW has no stable GCC 4.4 release yet, as far as I know

MinGW was officially updated to gcc 4.4 a few months ago.
Laurent Gomila - SFML developer

MistaED

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • http://alex.boberfly.com/
Qt + SFML
« Reply #14 on: January 11, 2010, 02:10:03 am »
Really easy fix, for some reason qtcreator/mingw makes redundant .a libs in addition to the .dll's on windows for the dynamic libs.

Compile it as normal and when it comes up with the linker issue, go into where the .dll's were built and delete the redundant .a files, then hit build again. The linker will now use the dll's instead of the empty .a files.

This happened to me when trying to compile Horde3D on windows via Qt/MinGW.

Also first post here, howdy!
-Alex

 

anything