Error?

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
Ruben98
Posts: 7
Joined: March 20th, 2013, 5:33 pm

Error?

Post by Ruben98 » March 28th, 2013, 2:31 pm

Hi i'm really enjoying chilis lessons.
But i have a problem.
I'm at beginner tutorial 12 now where I get this error.


1>------ Build started: Project: Chili DirectX Framework, Configuration: Debug Win32 ------
1> Game.cpp
1>c:\users\ruben\desktop\chili directx framework v12.04.24 (sfx) leren\assets\game.cpp(56): error C2761: 'void Game::SetSquareState(int,Game::XOState)' : member function redeclaration not allowed
1>c:\users\ruben\desktop\chili directx framework v12.04.24 (sfx) leren\assets\game.cpp(57): error C2447: '{' : missing function header (old-style formal list?)
1> Generating Code...
1> Compiling...
1> Windows.cpp
1> Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

[color=#800000]This is my game.h [/color]
/******************************************************************************************
* Chili DirectX Framework Version 12.04.24 *
* Game.h *
* Copyright 2012 PlanetChili.net *
* *
* This file is part of The Chili DirectX Framework. *
* *
* The Chili DirectX Framework is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* The Chili DirectX Framework is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with The Chili DirectX Framework. If not, see <http://www.gnu.org/licenses/>. *
******************************************************************************************/
#pragma once

#include "D3DGraphics.h"
#include "Keyboard.h"
#include "Mouse.h"
#include "Sound.h"

class Game
{
public:
Game( HWND hWnd,const KeyboardServer& kServer,const MouseServer& mServer );
void Go();

private:
enum XOState
{
EMPTY,
X,
O
};
/********************************/
/* User Functions */

/********************************/
private:
void ComposeFrame();
D3DGraphics gfx;
KeyboardClient kbd;
MouseClient mouse;
DSound audio;
void DrawGrid( int x,int y );
void DrawX( int x, int y);
void DrawO( int x, int y);
void SetSquareState( int index,XOState state );

private:
/********************************/
/* User Variables */

XOState s0;
XOState s1;
XOState s2;
XOState s3;
XOState s4;
XOState s5;
XOState s6;
XOState s7;
XOState s8;
int boxX;
int boxY;
int boxWidth;
int boxHeight;

/********************************/
};





[color=#BF0000]and my game.cpp[/color]
/******************************************************************************************
* Chili DirectX Framework Version 12.04.24 *
* Game.cpp *
* Copyright 2012 PlanetChili.net *
* *
* This file is part of The Chili DirectX Framework. *
* *
* The Chili DirectX Framework is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* The Chili DirectX Framework is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with The Chili DirectX Framework. If not, see <http://www.gnu.org/licenses/>. *
******************************************************************************************/
#include "Game.h"

Game::Game( HWND hWnd,const KeyboardServer& kServer,const MouseServer& mServer )
: gfx( hWnd ),
audio( hWnd ),
kbd( kServer ),
mouse( mServer )
{}

void Game::Go()
{
gfx.BeginFrame();
ComposeFrame();
gfx.EndFrame();
}
void Game::DrawGrid( int x, int y )
{
gfx.DrawLine( 0 + x,99 + y,299 + x,99 + y,255,255,255 );
gfx.DrawLine( 0 + x,199 + y,299 + x,199 + y,255,255,255 );
gfx.DrawLine( 99 + x,0 + y,99 + x,299 + y,255,255,255 );
gfx.DrawLine( 199 + x,0 + y,199 + x,299 + y,255,255,255 );

}

void Game::DrawX( int x, int y )
{
gfx.DrawLine( x + 15,y + 15,x + 84,y + 84,255,0,0 );
gfx.DrawLine( x + 15,y + 84,x + 84,y + 15,255,0,0 );
}
void Game::DrawO( int x, int y)
{
gfx.DrawCircle( x + 49,y + 49,35,0,0,255 );

}

void Game::SetSquareState( int index,XOState state );
{
switch( index )
{
case 0;
s0 = state;
break;
case 1:
s1 = state;
break;
case 2:
s2 = state;
break;
case 3:
s3 = state;
break;
case 4:
s4 = state;
break;
case 5:
s5 = state;
break;
case 6:
s6 = state;
break;
case 7:
s7 = state;
break;
case 8:
s8 = state;
break;
default:
break;
}
}

void Game::ComposeFrame()
{
DrawGrid( 0,0 );
DrawX( 0,0 );
DrawO( 100,100 );
}




plz help me :)
srry for bad english.

cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Re: Error?

Post by cameron » March 30th, 2013, 3:13 am

I found your error.
You said:
void Game::SetSquareState( int index,XOState state );
that is a declaration and you already declared it in game.h instead do
remove the ; at the end of void Game::SetSquareState( int index,XOState state );
Computer too slow? Consider running a VM on your toaster.

Ruben98
Posts: 7
Joined: March 20th, 2013, 5:33 pm

Re: Error?

Post by Ruben98 » March 30th, 2013, 10:40 am

Thanks for you're help Works now :)

Post Reply