SDL closes instantly

Hi everyone,
I just started learning SDL for obvious reasons.

I used the following video as a tutorial:
http://www.youtube.com/watch?v=cE4KNkABQAY

However, when I run it, it instantly quits, and I have no idea why...
Maybe I made a typo somewhere that I keep overlooking, or maybe there's some other thing that is causing this.

Here is the code in my project (which should be the exact same as in the video)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "SDL.h"

int main(int argc, char * args[])
{
	bool running = true;
	
	//Init SDL
	 if (SDL_Init(SDL_INIT_EVERYTHING) == -1)
	 {
		running = false;
	 }

	 //set up screen
	SDL_Surface *screen;
	screen = SDL_SetVideoMode(800,600,32,SDL_HWSURFACE);

	if (screen == NULL){
		running = false;
	}

	SDL_Event occur;

	//main application loop
	while (running)
	{

		SDL_PollEvent(&occur);

		if (occur.type = SDL_QUIT) {
			running = false;
		}
		//Drawing occurs here
		SDL_FillRect(screen, NULL, 0);
		SDL_Flip(screen);
	}
	
	//Quit SDL
	SDL_Quit();

	return 0;
}



And this is what is printed under 'output' in ms visual c++ 2010 express:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
'SDLtutorial.exe': Loaded 'C:\Users\Kasper\Documents\Visual Studio 2010\Projects\SDLtutorial\Debug\SDLtutorial.exe', Symbols loaded.
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SDL.dll', Binary was not built with debug information.
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\dciman32.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Unloaded 'C:\Windows\SysWOW64\ddraw.dll'
'SDLtutorial.exe': Unloaded 'C:\Windows\SysWOW64\dwmapi.dll'
'SDLtutorial.exe': Unloaded 'C:\Windows\SysWOW64\setupapi.dll'
'SDLtutorial.exe': Unloaded 'C:\Windows\SysWOW64\devobj.dll'
'SDLtutorial.exe': Unloaded 'C:\Windows\SysWOW64\oleaut32.dll'
'SDLtutorial.exe': Unloaded 'C:\Windows\SysWOW64\ole32.dll'
'SDLtutorial.exe': Unloaded 'C:\Windows\SysWOW64\cfgmgr32.dll'
'SDLtutorial.exe': Unloaded 'C:\Windows\SysWOW64\dciman32.dll'
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Program Files (x86)\McAfee\SiteAdvisor\sahook.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\KBDUS.DLL', Cannot find or open the PDB file
'SDLtutorial.exe': Unloaded 'C:\Windows\SysWOW64\KBDUS.DLL'
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\KBDBE.DLL', Cannot find or open the PDB file
'SDLtutorial.exe': Unloaded 'C:\Windows\SysWOW64\KBDBE.DLL'
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\dsound.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\powrprof.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\dinput.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\hid.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Cannot find or open the PDB file
'SDLtutorial.exe': Loaded 'C:\Windows\SysWOW64\clbcatq.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0x2c98) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x12a4) has exited with code 0 (0x0).
The program '[2800] SDLtutorial.exe: Native' has exited with code 0 (0x0).
Yep, a little typo :) if (occur.type = SDL_QUIT) should be ==
I should have seen that myself :P
thanks, it works perfectly fine now :)
Topic archived. No new replies allowed.