The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
VS2015 just 'hangs' on every SDL2 project
leBreaux


Joined: 28 Nov 2015
Posts: 8
Location: Amsterdam, Netherlands
Hello everyone, this is my first post on the SDL forums.
I'm having a serious issue with my development environment: Everytime I want to run or debug my compilation, stuff starts 'hanging', eg not responding.
For example: if I start from Visual Studio 2015, the IDE just stops responding. According to the task manager my code is running, but has no window and I'm rendered unable to stop my code. I have to force quit VS2015 and after that my code goes rogue and is taken over by "SYSTEM", so I cannot force quit it and remove the .exe manually.
The same goes for explorer: if I start the exe from windows, the active window wil freeze and show the same behaviour as VS2015.
My code is simply this test wether SDL is sane or not:
Code:
#include <iostream>
#include <SDL.h>

int main(int, char**){
   if (SDL_Init(SDL_INIT_VIDEO) != 0){
      std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
      return 1;
   }
   SDL_Quit();
   return 0;
}
only to get this result:

when I try to manually remove the .exe I get this:



There is also zero output in the Visual Studio console or anything. I have to reboot my pc in order to remove the .exes.
I just don't really have a clue where to start looking. The thing is I have exactly the same x86 libraries and headers on my laptop, with VS2013, working like a charm!
I know this is not very specific information but Visual Studio or Windows won't give me anything.
Any help or tips on where to look would be much appreciated! Thank you guys in advance.
leBreaux


Joined: 28 Nov 2015
Posts: 8
Location: Amsterdam, Netherlands
EDIT:I forgot to mention that my project does build. It just won't run.
Re: VS2015 just 'hangs' on every SDL2 project
DLudwig


Joined: 09 Feb 2012
Posts: 179
leBreaux wrote:
Hello everyone, this is my first post on the SDL forums.
I'm having a serious issue with my development environment: Everytime I want to run or debug my compilation, stuff starts 'hanging', eg not responding.
For example: if I start from Visual Studio 2015, the IDE just stops responding. According to the task manager my code is running, but has no window and I'm rendered unable to stop my code. I have to force quit VS2015 and after that my code goes rogue and is taken over by "SYSTEM", so I cannot force quit it and remove the .exe manually.
The same goes for explorer: if I start the exe from windows, the active window wil freeze and show the same behaviour as VS2015.


This is strange.

Have you tried stepping into your program with a debugger, seeing if it hits the main() function at all, or which SDL function it hangs in?

-- David L.
VS2015 just 'hangs' on every SDL2 project
MrOzBarry


Joined: 26 Jun 2010
Posts: 620
Although this may be overly simplistic - are you running your app in a loop but not running the SDL event loop (ie SDL_PollEvent())?

On Sun, Nov 29, 2015 at 9:44 PM, DLudwig wrote:
Quote:



leBreaux wrote:

Hello everyone, this is my first post on the SDL forums.
I'm having a serious issue with my development environment: Everytime I want to run or debug my compilation, stuff starts 'hanging', eg not responding.
For example: if I start from Visual Studio 2015, the IDE just stops responding. According to the task manager my code is running, but has no window and I'm rendered unable to stop my code. I have to force quit VS2015 and after that my code goes rogue and is taken over by "SYSTEM", so I cannot force quit it and remove the .exe manually.
The same goes for explorer: if I start the exe from windows, the active window wil freeze and show the same behaviour as VS2015.




This is strange.

Have you tried stepping into your program with a debugger, seeing if it hits the main() function at all, or which SDL function it hangs in?

-- David L.


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

VS2015 just 'hangs' on every SDL2 project
Owen Alanzo Hogarth
Guest

you have to poll events to allow some way to exit the program.

https://wiki.libsdl.org/SDL_QuitEvent



At least implement the code in that link above so that your machine doesn't lock up, you basically created an infinite loop that's causing your computer not to respond.


On Mon, Nov 30, 2015 at 10:49 AM, Alex Barry wrote:
Quote:
Although this may be overly simplistic - are you running your app in a loop but not running the SDL event loop (ie SDL_PollEvent())?

On Sun, Nov 29, 2015 at 9:44 PM, DLudwig wrote:


Quote:



leBreaux wrote:

Hello everyone, this is my first post on the SDL forums.
I'm having a serious issue with my development environment: Everytime I want to run or debug my compilation, stuff starts 'hanging', eg not responding.
For example: if I start from Visual Studio 2015, the IDE just stops responding. According to the task manager my code is running, but has no window and I'm rendered unable to stop my code. I have to force quit VS2015 and after that my code goes rogue and is taken over by "SYSTEM", so I cannot force quit it and remove the .exe manually.
The same goes for explorer: if I start the exe from windows, the active window wil freeze and show the same behaviour as VS2015.




This is strange.

Have you tried stepping into your program with a debugger, seeing if it hits the main() function at all, or which SDL function it hangs in?

-- David L.




_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org





_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

leBreaux


Joined: 28 Nov 2015
Posts: 8
Location: Amsterdam, Netherlands
Thanks for replying people, I'm at school now with only my laptop.
I'll try running the sanity test with an SDL_loop and also step debugging within VS2015 when I get home. Furthermore I was going to try SDL with MinGW and Eclipse Mars. Eclipse and Windows show exactly the same behaviour with only a basic "Hello World!", not even invoking anything related to SDL. I'm starting to fear this has something to do with my Windows setup rather than SDL...
leBreaux


Joined: 28 Nov 2015
Posts: 8
Location: Amsterdam, Netherlands
All right, Step debugging and using SDL events give the same behavior. I will now reinstall Windows, the single most fun thing to do in this whole wide world.