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

Author Topic: SFML with MinGW- Not Responding  (Read 2101 times)

0 Members and 1 Guest are viewing this topic.

evanperryg

  • Newbie
  • *
  • Posts: 3
    • View Profile
SFML with MinGW- Not Responding
« on: August 12, 2017, 08:17:58 pm »
Hello, I am trying to use the SFML libraries in CodeLite using MinGW. I'm pretty familiar with SFML itself but I'm having trouble getting it to work in MinGW. I can build the program but when I run it I get "main.cpp has stopped responding." Here is my code:

#define SFML_STATIC

#include <iostream>

#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>

int main()
{
    sf::Window window(sf::VideoMode(800, 600), "POS");

    while (window.isOpen())
    {
       
        sf::Event event;
        while (window.pollEvent(event))
        {
           
            if (event.type == sf::Event::Closed)
                window.close();
        }
    }
   
    return 0;
}
 

Here is a screenshot of my build settings (this is the only part that's not default):


Here is a screenshot of the project settings, showing include paths and the preprocessor command:


Here is more of the project settings, showing the project-specific libraries search path and the Libraries section.


I have tried using "sfml-xxxxx," "sfml-xxxxx-d," "sfml-xxxxx-s," "sfml-xxxxx-s-d" in the Libraries section, and when I build and run the program, I always get this:


Other things:
-I'm using Windows 10 64-bit.
-I have tried these resources, among others: https://en.sfml-dev.org/forums/index.php?topic=18820.0, https://en.sfml-dev.org/forums/index.php?topic=11284.0, https://stackoverflow.com/questions/35712754/sfml-applications-has-stopped-responding

Hopefully someone can help. Thanks!

« Last Edit: August 12, 2017, 08:21:06 pm by evanperryg »

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: SFML with MinGW- Not Responding
« Reply #1 on: August 13, 2017, 12:06:05 am »
You need to call window.display (and clear and/or some drawing) in the while window.isOpen() loop.
Back to C++ gamedev with SFML in May 2023

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10998
    • View Profile
    • development blog
    • Email
Re: SFML with MinGW- Not Responding
« Reply #2 on: August 13, 2017, 01:33:40 am »
Basically, read the official tutorials nd follow them. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

evanperryg

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: SFML with MinGW- Not Responding
« Reply #3 on: August 13, 2017, 05:30:50 am »
You need to call window.display (and clear and/or some drawing) in the while window.isOpen() loop.

This code is literally copy-pasted from the tutorials page: https://www.sfml-dev.org/tutorials/2.0/window-window.php

Basically, read the official tutorials nd follow them. ;)

As I said in the original post, I followed the instructions given here: https://en.sfml-dev.org/forums/index.php?topic=18820.0 and have not found success.

I'm aware of the redundancy of having libraries included in both the global build settings and the project build settings. I've tried placing them in the project settings, and the global settings with no success.

evanperryg

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: SFML with MinGW- Not Responding
« Reply #4 on: August 13, 2017, 06:45:52 am »
Okay, well. I'm not really sure what I did that fixed it, but whatever I did it works now. For any equally confused CodeLite users in the future:
  • I used the "GCC 6.1.0 MinGW (SEH) - 64-bit" package from the SFML download page.
  • I'm using the TDM-GCC version of MinGW.
  • This is the contents of the "libraries" box under the "Linker" page in the project settings:
    sfml-graphics-s-d
    sfml-window-s-d
    sfml-audio-s-d
    sfml-network-s-d
    sfml-system-s-d
    opengl32
    jpeg
    openal32
    gdi32
    freetype
    winmm
  • This is the contents of the "linker options" under the "Linker" page in the project settings: -static-libgcc;-static-libstdc++
  • The preprocessor setting under "Compiler" in the project settings contains: SFML_STATIC
  • All of the global settings are default[\li]

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10998
    • View Profile
    • development blog
    • Email
Re: SFML with MinGW- Not Responding
« Reply #5 on: August 13, 2017, 08:33:33 am »


  • I used the "GCC 6.1.0 MinGW (SEH) - 64-bit" package from the SFML download page.
  • I'm using the TDM-GCC version of MinGW.
This doesn't work. As stated on the download page, compiler and libraries need to match 100%.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything