SFML community forums
Help => General => Topic started by: Fellow Traveler 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:
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?
-
When I trying to make project i get link errors.
Which ones?
-
like this:
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'
-
Are you sure that you use g++ and not gcc?
-
i use g++. Here is the keys:
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:
F:/my/Programming/qt/SFML/QSFMLCanvas.cpp:17: undefined reference to `__gxx_personality_sj0'
and errors like this:
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'
-
This is the link command line, what about the command line that compiles your cpp files into .o?
-
Are you using gcc 4.4.0?
-
sorry, actually i use QtCreator i didn't worry about paramethers.
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:
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.
-
Weird. What if you use static libraries?
I have not disk D and this folders at all.
These are the paths on my disk ;)
-
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
-
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.
-
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
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:
Lauching F:\my\Programming\qt\SFML\debug\SFML.exe...
F:\my\Programming\qt\SFML\debug\SFML.exe ends with code -1073741515
-
Qt uses 4.4.x in its latest release, ...
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
-
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.
-
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!
-
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!
The .a files are used to tell the compiler where in the DLL each function is(iirc), so they are not redundant.