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

Author Topic: Any call to SFML crashes on execution  (Read 1400 times)

0 Members and 1 Guest are viewing this topic.

Vii

  • Newbie
  • *
  • Posts: 1
    • View Profile
Any call to SFML crashes on execution
« on: October 22, 2014, 07:45:26 pm »
Hi,

I am new to SFML but I can't even give it a try, any time I make a call to anything to do with SFML the application crashes immediately. I can include, but I can not use anything.

I am using QT Creator as the IDE and qmake to build. If you think it'd help I can switch to cmake.

For my qmake file I have simply added every header relevant to SFML and main, system, and window libs. This is my qmake file:

Code: [Select]
#-------------------------------------------------
#
# Project created by QtCreator 2014-10-23T04:01:42
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = CBlock
TEMPLATE = app


SOURCES += main.cpp\
        ui.cpp

HEADERS  += ui.h \
    SFML/Audio/Export.hpp \
    SFML/Audio/Listener.hpp \
    SFML/Audio/Music.hpp \
    SFML/Audio/Sound.hpp \
    SFML/Audio/SoundBuffer.hpp \
    SFML/Audio/SoundBufferRecorder.hpp \
    SFML/Audio/SoundRecorder.hpp \
    SFML/Audio/SoundSource.hpp \
    SFML/Audio/SoundStream.hpp \
    SFML/Graphics/BlendMode.hpp \
    SFML/Graphics/CircleShape.hpp \
    SFML/Graphics/Color.hpp \
    SFML/Graphics/ConvexShape.hpp \
    SFML/Graphics/Drawable.hpp \
    SFML/Graphics/Export.hpp \
    SFML/Graphics/Font.hpp \
    SFML/Graphics/Glyph.hpp \
    SFML/Graphics/Image.hpp \
    SFML/Graphics/PrimitiveType.hpp \
    SFML/Graphics/Rect.hpp \
    SFML/Graphics/RectangleShape.hpp \
    SFML/Graphics/RenderStates.hpp \
    SFML/Graphics/RenderTarget.hpp \
    SFML/Graphics/RenderTexture.hpp \
    SFML/Graphics/RenderWindow.hpp \
    SFML/Graphics/Shader.hpp \
    SFML/Graphics/Shape.hpp \
    SFML/Graphics/Sprite.hpp \
    SFML/Graphics/Text.hpp \
    SFML/Graphics/Texture.hpp \
    SFML/Graphics/Transform.hpp \
    SFML/Graphics/Transformable.hpp \
    SFML/Graphics/Vertex.hpp \
    SFML/Graphics/VertexArray.hpp \
    SFML/Graphics/View.hpp \
    SFML/Network/Export.hpp \
    SFML/Network/Ftp.hpp \
    SFML/Network/Http.hpp \
    SFML/Network/IpAddress.hpp \
    SFML/Network/Packet.hpp \
    SFML/Network/Socket.hpp \
    SFML/Network/SocketHandle.hpp \
    SFML/Network/SocketSelector.hpp \
    SFML/Network/TcpListener.hpp \
    SFML/Network/TcpSocket.hpp \
    SFML/Network/UdpSocket.hpp \
    SFML/System/Clock.hpp \
    SFML/System/Err.hpp \
    SFML/System/Export.hpp \
    SFML/System/InputStream.hpp \
    SFML/System/Lock.hpp \
    SFML/System/Mutex.hpp \
    SFML/System/NonCopyable.hpp \
    SFML/System/Sleep.hpp \
    SFML/System/String.hpp \
    SFML/System/Thread.hpp \
    SFML/System/ThreadLocal.hpp \
    SFML/System/ThreadLocalPtr.hpp \
    SFML/System/Time.hpp \
    SFML/System/Utf.hpp \
    SFML/System/Vector2.hpp \
    SFML/System/Vector3.hpp \
    SFML/Window/Context.hpp \
    SFML/Window/ContextSettings.hpp \
    SFML/Window/Event.hpp \
    SFML/Window/Export.hpp \
    SFML/Window/GlResource.hpp \
    SFML/Window/Joystick.hpp \
    SFML/Window/Keyboard.hpp \
    SFML/Window/Mouse.hpp \
    SFML/Window/Sensor.hpp \
    SFML/Window/Touch.hpp \
    SFML/Window/VideoMode.hpp \
    SFML/Window/Window.hpp \
    SFML/Window/WindowHandle.hpp \
    SFML/Window/WindowStyle.hpp \
    SFML/Audio.hpp \
    SFML/Config.hpp \
    SFML/Graphics.hpp \
    SFML/Main.hpp \
    SFML/Network.hpp \
    SFML/OpenGL.hpp \
    SFML/System.hpp \
    SFML/Window.hpp

FORMS    += ui.ui

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/lib/ -lsfml-window
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/lib/ -lsfml-window-d
else:unix: LIBS += -L$$PWD/lib/ -lsfml-window

INCLUDEPATH += $$PWD/
DEPENDPATH += $$PWD/

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/lib/ -lsfml-main
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/lib/ -lsfml-main-d
else:unix: LIBS += -L$$PWD/lib/ -lsfml-main

INCLUDEPATH += $$PWD/
DEPENDPATH += $$PWD/

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/lib/ -lsfml-system
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/lib/ -lsfml-system-d
else:unix: LIBS += -L$$PWD/lib/ -lsfml-system

INCLUDEPATH += $$PWD/
DEPENDPATH += $$PWD/

With the call to sf::Joystick::update(); commented out the crash no longer occurs. This is my main.cpp file:

Code: [Select]
#include "ui.h"
#include <QApplication>
#include <SFML/Main.hpp>
#include <SFML/Window.hpp>
#include <SFML/Window/Joystick.hpp>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    UI w;
    w.show();

    sf::Joystick::update();

    return a.exec();
}


Here is the compiler output:

Code: [Select]
06:46:18: Running steps for project CBlock...
06:46:18: Starting: "D:\Qt\Qt5.3.2\5.3\msvc2013_opengl\bin\qmake.exe" "D:\Projects\C Projects\CBlock\CBlock.pro" -r -spec win32-msvc2013 "CONFIG+=debug"
06:46:18: The process "D:\Qt\Qt5.3.2\5.3\msvc2013_opengl\bin\qmake.exe" exited normally.
06:46:18: Starting: "D:\Qt\Qt5.3.2\Tools\QtCreator\bin\jom.exe"
D:\Qt\Qt5.3.2\Tools\QtCreator\bin\jom.exe -f Makefile.Debug
D:\Qt\Qt5.3.2\5.3\msvc2013_opengl\bin\uic.exe ..\CBlock\ui.ui -o ui_ui.h
cl -c -nologo -Zm200 -Zc:wchar_t -FS -Zi -MDd -GR -W3 -w34100 -w34189 -EHsc /Fddebug\CBlock.pdb -DUNICODE -DWIN32 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I"..\CBlock" -I"..\CBlock" -I"..\CBlock" -I"..\..\..\Qt\Qt5.3.2\5.3\msvc2013_opengl\include" -I"..\..\..\Qt\Qt5.3.2\5.3\msvc2013_opengl\include\QtWidgets" -I"..\..\..\Qt\Qt5.3.2\5.3\msvc2013_opengl\include\QtGui" -I"..\..\..\Qt\Qt5.3.2\5.3\msvc2013_opengl\include\QtCore" -I"debug" -I"." -I"." -I"..\..\..\Qt\Qt5.3.2\5.3\msvc2013_opengl\mkspecs\win32-msvc2013" -Fodebug\ @C:\Users\Jared\AppData\Local\Temp\main.obj.5784.16.jom
main.cpp
D:\Qt\Qt5.3.2\5.3\msvc2013_opengl\bin\moc.exe -DUNICODE -DWIN32 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1800 -D_WIN32 -ID:/Qt/Qt5.3.2/5.3/msvc2013_opengl/mkspecs/win32-msvc2013 -I"D:/Projects/C Projects/CBlock" -I"D:/Projects/C Projects/CBlock" -I"D:/Projects/C Projects/CBlock" -I"D:/Projects/C Projects/CBlock" -ID:/Qt/Qt5.3.2/5.3/msvc2013_opengl/include -ID:/Qt/Qt5.3.2/5.3/msvc2013_opengl/include/QtWidgets -ID:/Qt/Qt5.3.2/5.3/msvc2013_opengl/include/QtGui -ID:/Qt/Qt5.3.2/5.3/msvc2013_opengl/include/QtCore -I. ..\CBlock\ui.h -o debug\moc_ui.cpp
cl -c -nologo -Zm200 -Zc:wchar_t -FS -Zi -MDd -GR -W3 -w34100 -w34189 -EHsc /Fddebug\CBlock.pdb -DUNICODE -DWIN32 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I"..\CBlock" -I"..\CBlock" -I"..\CBlock" -I"..\..\..\Qt\Qt5.3.2\5.3\msvc2013_opengl\include" -I"..\..\..\Qt\Qt5.3.2\5.3\msvc2013_opengl\include\QtWidgets" -I"..\..\..\Qt\Qt5.3.2\5.3\msvc2013_opengl\include\QtGui" -I"..\..\..\Qt\Qt5.3.2\5.3\msvc2013_opengl\include\QtCore" -I"debug" -I"." -I"." -I"..\..\..\Qt\Qt5.3.2\5.3\msvc2013_opengl\mkspecs\win32-msvc2013" -Fodebug\ @C:\Users\Jared\AppData\Local\Temp\ui.obj.5784.16.jom
ui.cpp
cl -c -nologo -Zm200 -Zc:wchar_t -FS -Zi -MDd -GR -W3 -w34100 -w34189 -EHsc /Fddebug\CBlock.pdb -DUNICODE -DWIN32 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I"..\CBlock" -I"..\CBlock" -I"..\CBlock" -I"..\..\..\Qt\Qt5.3.2\5.3\msvc2013_opengl\include" -I"..\..\..\Qt\Qt5.3.2\5.3\msvc2013_opengl\include\QtWidgets" -I"..\..\..\Qt\Qt5.3.2\5.3\msvc2013_opengl\include\QtGui" -I"..\..\..\Qt\Qt5.3.2\5.3\msvc2013_opengl\include\QtCore" -I"debug" -I"." -I"." -I"..\..\..\Qt\Qt5.3.2\5.3\msvc2013_opengl\mkspecs\win32-msvc2013" -Fodebug\ @C:\Users\Jared\AppData\Local\Temp\moc_ui.obj.5784.140.jom
moc_ui.cpp
echo 1 /* CREATEPROCESS_MANIFEST_RESOURCE_ID */ 24 /* RT_MANIFEST */ "debug\\CBlock.exe.embed.manifest">debug\CBlock.exe_manifest.rc
if not exist debug\CBlock.exe if exist debug\CBlock.exe.embed.manifest del debug\CBlock.exe.embed.manifest
if exist debug\CBlock.exe.embed.manifest copy /Y debug\CBlock.exe.embed.manifest debug\CBlock.exe_manifest.bak
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST /MANIFESTFILE:debug\CBlock.exe.embed.manifest /OUT:debug\CBlock.exe @C:\Users\Jared\AppData\Local\Temp\CBlock.exe.5784.1045.jom
if exist debug\CBlock.exe_manifest.bak fc /b debug\CBlock.exe.embed.manifest debug\CBlock.exe_manifest.bak >NUL || del debug\CBlock.exe_manifest.bak
if not exist debug\CBlock.exe_manifest.bak rc.exe /fodebug\CBlock.exe_manifest.res debug\CBlock.exe_manifest.rc
Microsoft (R) Windows (R) Resource Compiler Version 6.3.9600.17200

Copyright (C) Microsoft Corporation.  All rights reserved.


if not exist debug\CBlock.exe_manifest.bak link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST /MANIFESTFILE:debug\CBlock.exe.embed.manifest /OUT:debug\CBlock.exe @C:\Users\Jared\AppData\Local\Temp\CBlock.exe.5784.1061.jom
if exist debug\CBlock.exe_manifest.bak del debug\CBlock.exe_manifest.bak
06:46:20: The process "D:\Qt\Qt5.3.2\Tools\QtCreator\bin\jom.exe" exited normally.
06:46:20: Elapsed time: 00:02.

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Any call to SFML crashes on execution
« Reply #1 on: October 22, 2014, 08:16:34 pm »
Use a debugger to get a stacktrace when it crashes. In the debugger you can also inspect variables in the individual stack frames to help you get an idea of why it crashes.