I'm trying to make a CPP file and header file but it keeps erroring out. Not sure what I'm doing wrong!
Shapes.h
Code: Select all
#pragma once
class Shapes
{
public:
void DrawSquare( int size,int offsetX,int offsetY,int r,int g,int b);
private:
}
Code: Select all
#include "Shapes.h"
#include "D3DGraphics.h"
void Shapes::DrawSquare( int size,int offsetX,int offsetY,int r,int g,int b)
{
for(int y = 0; y <= size; y++)
{
for(int x = 0; x <= size; x++)
{
D3DGraphics::PutPixel(x,y,r,g,b);
}
}
}
Code: Select all
1>------ Build started: Project: Chili DirectX Framework, Configuration: Release Win32 ------
1> Game.cpp
1>c:\users\simon.kay\documents\c++\tetris\assets\Game.h(45): error C2236: unexpected 'class' 'Game'. Did you forget a ';'?
1>c:\users\simon.kay\documents\c++\tetris\assets\Game.h(45): error C2143: syntax error : missing ';' before '{'
1>c:\users\simon.kay\documents\c++\tetris\assets\Game.h(45): error C2447: '{' : missing function header (old-style formal list?)
1>..\Assets\Game.cpp(26): error C2653: 'Game' : is not a class or namespace name
1>..\Assets\Game.cpp(27): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\Assets\Game.cpp(31): error C2550: 'Game' : constructor initializer lists are only allowed on constructor definitions
1>..\Assets\Game.cpp(32): warning C4508: 'Game' : function should return a value; 'void' return type assumed
1>..\Assets\Game.cpp(34): error C2653: 'Game' : is not a class or namespace name
1>..\Assets\Game.cpp(36): error C2065: 'gfx' : undeclared identifier
1>..\Assets\Game.cpp(36): error C2228: left of '.BeginFrame' must have class/struct/union
1> type is ''unknown-type''
1>..\Assets\Game.cpp(37): error C3861: 'ComposeFrame': identifier not found
1>..\Assets\Game.cpp(38): error C2065: 'gfx' : undeclared identifier
1>..\Assets\Game.cpp(38): error C2228: left of '.EndFrame' must have class/struct/union
1> type is ''unknown-type''
1>..\Assets\Game.cpp(41): error C2653: 'Game' : is not a class or namespace name
1> Shapes.cpp
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(29): error C2628: 'Shapes' followed by 'unsigned' is illegal (did you forget a ';'?)
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(29): error C2628: 'Shapes' followed by 'int' is illegal (did you forget a ';'?)
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(29): error C2347: '__w64' : can not be used with type '__w64 Shapes'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(29): error C2371: 'size_t' : redefinition; different basic types
1> predefined C++ types (compiler internal)(19) : see declaration of 'size_t'
1>..\Assets\Shapes.cpp(10): error C2352: 'D3DGraphics::PutPixel' : illegal call of non-static member function
1> c:\users\simon.kay\documents\c++\tetris\assets\D3DGraphics.h(34) : see declaration of 'D3DGraphics::PutPixel'
1> Windows.cpp
1>c:\users\simon.kay\documents\c++\tetris\assets\Game.h(45): error C2236: unexpected 'class' 'Game'. Did you forget a ';'?
1>c:\users\simon.kay\documents\c++\tetris\assets\Game.h(45): error C2143: syntax error : missing ';' before '{'
1>c:\users\simon.kay\documents\c++\tetris\assets\Game.h(45): error C2447: '{' : missing function header (old-style formal list?)
1>..\Assets\Windows.cpp(163): error C2065: 'Game' : undeclared identifier
1>..\Assets\Windows.cpp(163): error C2146: syntax error : missing ';' before identifier 'theGame'
1>..\Assets\Windows.cpp(163): error C3861: 'theGame': identifier not found
1>..\Assets\Windows.cpp(176): error C2065: 'theGame' : undeclared identifier
1>..\Assets\Windows.cpp(176): error C2228: left of '.Go' must have class/struct/union
1> type is ''unknown-type''
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========