Having some trouble starting with SDL 2.0.

Hello everyone , I am still learning c++ as a beginner and i made it through the basics , now i am focusing on 2d arcade games. I am using SDL 2.0 in visual studio C++ and the thing is i can't get my code to run it is giving me this error
(fatal error C1075: end of file found before the left brace '{' at 'c:\users\tarek\desktop\newgamebreakout\breakout\breakout\stdafx.h(13)' was matched)
P.s : I am still trying to only sort the window only.
anyway here is my code.
Thank you in advance.

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
#include <SDL.h>
#include<SDL_image.h>
#include <SDL_mixer.h>
#include <stdio.h>


SDL_Window* g_pWindow = 0; 
SDL_Renderer* g_pRenderer = 0;
bool g_bRunning = false;


bool init(const char* Screen, int xpos, int ypos, int height, int width, int flags)
{
	// initialize SDL  
	if(SDL_Init(SDL_INIT_EVERYTHING >=0))  {   
		// if succeeded create our window   
		g_pWindow = SDL_CreateWindow("Chapter 1: Setting up SDL", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,640, 480,SDL_WINDOW_SHOWN);

		// if the window creation succeeded create our renderer    
		if(g_pWindow != 0)   
		{     
			g_pRenderer = SDL_CreateRenderer(g_pWindow, -1, 0);   
		}  }  
	else  {
		return false;
}	// sdl could not initialize  
	return true;	
		// everything succeeded lets draw the window
		// set to black // This function expects Red, Green, Blue and   //  Alpha as color values  
	void render()
	{
		SDL_SetRenderDrawColor(g_pRenderer, 0, 0, 0, 255);
		// clear the window to black  
		SDL_RenderClear(g_pRenderer);
		// show the window

		SDL_RenderPresent(g_pRenderer);
	}
		
	int main(int argc, char* argv[])
	{
		if (init("Breakout copy Game ", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_SHOWN))
		{
			g_bRunning = true;
		}
		else
		{
			return 1;//something's wrong
		}
		while (g_bRunning)
		{
			render()
		}
		// clean up SDL		
		SDL_Quit();
		return 0;
}
If you make sure to indent your code properly the error will be obvious.
Thanks for the advice , i have done that , the build was successful but it is not running . i don't understand what is happening.
Topic archived. No new replies allowed.