Hello, I've been having this error come up whenever I try to compile this code:

#include "stdafx.h"
#include "Strides.h"

int m_Stride;

bool chams = true;
bool onetime = true;

int main();
{

	if (chams)
	{


			const BYTE bRed[60] = //red
			{
			0x42, 0x4D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
			0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
			0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x12, 0x0B, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0xFF, 0x00, 0x00, 0x50
			}

			const BYTE bGold[60] = //yellow
			{
			0x42, 0x4D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
			0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
			0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x12, 0x0B, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0xFF, 0xFF, 0x00, 0x00, 0x01
			}

			LPDIRECT3DTEXTURE8 texRed; //texture
			LPDIRECT3DTEXTURE8 texYellow; //texture



			HRESULT APIENTRY hkIDirect3DDevice8::BeginScene(void)
			{
				if(onetime)
				{
						//create our textures
						onetime = false;
						D3DXCreateTextureFromFileInMemory(m_pD3Ddev,(LPCVO ID)&bRed,60,&texRed) ;
						D3DXCreateTextureFromFileInMemory(m_pD3Ddev,(LPCVO ID)&bGold,60,&texYellow);

				}
			return m_pD3Ddev->BeginScene();
			}

hkIDirect3DDevice8:DrawIndexedPrimitive(D3DPRIMITIV ETYPE PrimitiveType,UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount)
	if(m_Stride == 36)
	{
			m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, false);
			m_pD3Ddev->SetTexture(0, texRed);
			m_pD3Ddev->SetRenderState(D3DRS_LIGHTING,false);
			m_pD3Ddev->DrawIndexedPrimitive(PrimitiveType, minIndex, NumVertices, startIndex, primCount);
			m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, true);
			m_pD3Ddev->SetTexture(0, texYellow);
			m_pD3Ddev->SetRenderState(D3DRS_LIGHTING,false);


HRESULT APIENTRY hkIDirect3DDevice8:rawIndexedPrimitive(D3DPRIMITIV ETYPE PrimitiveType,UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount)
{
	if(m_Stride == 32)
	{
			m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, false);
			m_pD3Ddev->SetTexture(0, texRed);
			m_pD3Ddev->SetRenderState(D3DRS_LIGHTING,false);
			m_pD3Ddev->DrawIndexedPrimitive(PrimitiveType, minIndex, NumVertices, startIndex, primCount);
			m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, true);
			m_pD3Ddev->SetTexture(0, texYellow);
			m_pD3Ddev->SetRenderState(D3DRS_LIGHTING,false);
			return m_pD3Ddev->DrawIndexedPrimitive(PrimitiveType, minIndex, NumVertices, startIndex, primCount);
	}
}
	}
	}
}

The error will come up at line 13... Which is where i begin the main function.

I have looked through this code many times and I can't seem to find anything wrong with it, I've moved brackets around, deleted some code, etc. But it still give me the same error.

(Hidden).cpp(13) : error C2447: '{' : missing function header (old-style formal list?)

Recommended Answers

All 4 Replies

int main();

Are you sure you wanted a semicolon there?

When I remove the semicolon I get these errors:

1>BrokezOP7+Chams.cpp
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(30) : error C2143: syntax error : missing ';' before 'const'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(30) : error C2143: syntax error : missing ';' before 'const'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(31) : error C2143: syntax error : missing ';' before '{'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(39) : error C2143: syntax error : missing ';' before '}'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(41) : error C2065: 'LPDIRECT3DTEXTURE8' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(41) : error C2146: syntax error : missing ';' before identifier 'texRed'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(41) : error C2065: 'texRed' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(42) : error C2065: 'LPDIRECT3DTEXTURE8' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(42) : error C2146: syntax error : missing ';' before identifier 'texYellow'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(42) : error C2065: 'texYellow' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(46) : error C2653: 'hkIDirect3DDevice8' : is not a class or namespace name
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(47) : error C2601: 'BeginScene' : local function definitions are illegal
1>        c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(16): this line contains a '{' which has not yet been matched
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(59) : error C2065: 'D3DPRIMITIV' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(59) : error C2146: syntax error : missing ')' before identifier 'ETYPE'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(59) : error C2059: syntax error : ')'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(61) : error C2143: syntax error : missing ';' before '{'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(62) : error C2065: 'm_pD3Ddev' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(62) : error C2227: left of '->SetRenderState' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(62) : error C2065: 'D3DRS_ZENABLE' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(59) : error C3861: 'DrawIndexedPrimitive': identifier not found
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(63) : error C2065: 'm_pD3Ddev' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(63) : error C2227: left of '->SetTexture' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(63) : error C2065: 'texRed' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(64) : error C2065: 'm_pD3Ddev' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(64) : error C2227: left of '->SetRenderState' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(64) : error C2065: 'D3DRS_LIGHTING' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(65) : error C2065: 'm_pD3Ddev' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(65) : error C2227: left of '->DrawIndexedPrimitive' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(65) : error C2065: 'PrimitiveType' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(65) : error C2065: 'minIndex' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(65) : error C2065: 'NumVertices' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(65) : error C2065: 'startIndex' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(65) : error C2065: 'primCount' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(66) : error C2065: 'm_pD3Ddev' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(66) : error C2227: left of '->SetRenderState' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(66) : error C2065: 'D3DRS_ZENABLE' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(67) : error C2065: 'm_pD3Ddev' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(67) : error C2227: left of '->SetTexture' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(67) : error C2065: 'texYellow' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(68) : error C2065: 'm_pD3Ddev' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(68) : error C2227: left of '->SetRenderState' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(68) : error C2065: 'D3DRS_LIGHTING' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(71) : warning C4229: anachronism used : modifiers on data are ignored
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(71) : error C2059: syntax error : ':'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(52) : error C2065: 'm_pD3Ddev' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(52) : error C2065: 'LPCVO' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(52) : error C2146: syntax error : missing ')' before identifier 'ID'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(52) : error C2059: syntax error : ')'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(53) : error C2065: 'm_pD3Ddev' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(53) : error C2065: 'LPCVO' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(53) : error C2146: syntax error : missing ')' before identifier 'ID'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(53) : error C2059: syntax error : ')'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(56) : error C2065: 'm_pD3Ddev' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(56) : error C2227: left of '->BeginScene' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(52) : error C3861: 'D3DXCreateTextureFromFileInMemory': identifier not found
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(53) : error C3861: 'D3DXCreateTextureFromFileInMemory': identifier not found
1>Build log was saved at "file://c:\Documents and Settings\Collin Inman\My Documents\Visual Studio 2008\Projects\BrokezOP7+Chams\BrokezOP7+Chams\Debug\BuildLog.htm"

You should learn the basics of C/C++ before you attempt to make a game cheat/hack.
This is simply copy/pasting code and then copy/pasting the error here.

Btw, if you read the errors it tells you exactly what to do.

I've been learning C++ for about 4-5 months so I know the basics of C++ just fine.
I've already made 2 hacks but I don't understand the missing function error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.