SDL2 - Can't see the Window


Hi all,

Running into a problem with SDL2- when I make a window, I can’t see it! I’m running the latest version of Mac OS X.

I’m trying to follow the Lazy Foo tutorials here

I’ve also read the docs for SDL_CreateWindow here

I’ve tried the Lazy Foo tutorials for Mac OS X using Xcode, as well as building SDL2 myself (following the Linux tutorials) and running it. I’ve also tried the code from the SDL_CreateWindow docs page.

I have no problems compiling. It compiles fine. When I run it, whether with ./01_hello_SDL or hitting the play button in XCode, I can see that something runs (the spinning wheel comes up in the GUI for Xcode or in the top right of terminal when running with ./filename). However, I don’t see any window or image popup.

What am I doing wrong?

Thanks for the help!


Ok, I found the issue. The window wouldn’t show up on OS X unless I had an event loop going (prior I had an SDL_Delay call).

Now I’m curious- why do I need the event loop? Why isn’t the SDL_Delay sufficient?

(LazyFoo gives an example of the event loop on this page.)