Anoying fatal error when debuging....

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
CppMc
Posts: 6
Joined: May 11th, 2012, 7:47 pm

Anoying fatal error when debuging....

Post by CppMc » May 11th, 2012, 7:58 pm

So this error appears in the build out put :


..\Assets\Game.cpp(72): fatal error C1075: end of file found before the left brace '{' at '..\Assets\Game.cpp(43)' was matched


some times i have it some times i do not , and i cant figure out where i do something wrong

Here is the code , it brings me here after double click on the error line



#include "Game.h"

Game::Game( HWND hWnd,const KeyboardServer& kServer )
: gfx ( hWnd ),
kbd( kServer ),
x ( 300 ),
y ( 200 ),
m (225),
n (225),
o (225)


{}

void Game::Go()
{
gfx.BeginFrame();
ComposeFrame();
gfx.EndFrame();
}

void Game::ComposeFrame()
{

for(int i=0;i<=100;i++)
{
gfx.PutPixel(x+i,y,m,n,o);
}

for(int i=0;i<=100;i++)
{
gfx.PutPixel(x,y+i,m,n,o);
}
for(int i=0;i<=100;i++)
{
gfx.PutPixel(x+i,y+100,m,n,o);
}
for(int i=0;i<=100;i++)
{
gfx.PutPixel(x+100,y+i,m,n,o);
}
for(int i=0;i<=600;i++)
for(int j=0;j<=600;j++)
{
gfx.PutPixel(0+j,0+i,m,n,o);
if((0+j)>=300 &&(0+j)<=400 && (0+i)>=200 && (0+i)<=300)
{ m=0;
n=0;
o=0;
}
}




all variables m n o x y are defined in the main class as private all is fine there

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Anoying fatal error when debuging....

Post by LuX » May 11th, 2012, 8:27 pm

Code: Select all

for(int i=0;i<=600;i++)
for(int j=0;j<=600;j++)
{
gfx.PutPixel(0+j,0+i,m,n,o);
if((0+j)>=300 &&(0+j)<=400 && (0+i)>=200 && (0+i)<=300)
{ m=0;
n=0;
o=0;
}
ʕ •ᴥ•ʔ

CppMc
Posts: 6
Joined: May 11th, 2012, 7:47 pm

Re: Anoying fatal error when debuging....

Post by CppMc » May 11th, 2012, 9:01 pm

hmm i cant see it :( where did i go wrong

CppMc
Posts: 6
Joined: May 11th, 2012, 7:47 pm

Re: Anoying fatal error when debuging....

Post by CppMc » May 11th, 2012, 9:37 pm

?

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Anoying fatal error when debuging....

Post by LuX » May 11th, 2012, 10:23 pm

You are missing a lot of colons, add one after "for(int i=0;i<=600;i++)"
and then add two more to the end.

Also, not sure if that's what you want, but "i<=600;i++" means that as i = 600, it will still add one digit, meaning that i's final value will be 601. If you want i to stop at 600 just leave it at i<600;
ʕ •ᴥ•ʔ

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Anoying fatal error when debuging....

Post by chili » May 12th, 2012, 1:58 am

Looks like you're missing a curly bracket at the end.

P.S. is that what your code looks like in the source editor too (I mean with no tabs inserted)? If so, there's no wonder why you're making mistakes like this, nor why you're having trouble finding them when you make them.
Chili

CppMc
Posts: 6
Joined: May 11th, 2012, 7:47 pm

Re: Anoying fatal error when debuging....

Post by CppMc » May 13th, 2012, 11:03 pm

Ok thank you both .I will try the tab thing in future chili.

Post Reply