Sign in to follow this  

error msg?

This topic is 4834 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

well, I have been sitting still for two days now.. I get this error msg: c:\documents and settings\hans-petter harveg\mine dokumenter\mine prosjekter\d3d9 engine\anim.h(47) : error C2146: syntax error : missing ';' before identifier 'cTGA' when I compile this code:

#include "tga.h"

[...]

typedef struct Frame {
        [...]
	AnimVertexStruct_t		sCustomVertex;

	TGA   cTGA;
        [...]
} Frame_t, *pFrame;

Share this post


Link to post
Share on other sites
The error could be on any of the lines before "cTGA;", or even in the definition of the TGA type. So post the code.

It takes a while to come to grips with the way C (and C++) process source code. Error messages do not indicate where a parse error occured, but rather where it was detected.

Share this post


Link to post
Share on other sites
aha! ok, I can see why you have a superman logo, hehe :)

this post is really long, hehe


#ifndef _TGA_H_
#define _TGA_H_


#include <stdio.h>
#include <string.h>

#include "debug.h"

//#pragma pack 1
typedef struct TGAHeader
{
unsigned char vIDLength;
unsigned char vColorMapType;
unsigned char vImageType;
unsigned short vCMapStart;
unsigned short vCMapLength;
unsigned char vCMapDepth;
unsigned short vXOffset;
unsigned short vWidth;
unsigned short vHeight;
unsigned char vPixelDepth;
unsigned short vYOffset;
unsigned char vImageDescriptor;
} TGAHeader_t;
typedef TGAHeader_t* TGAHeader_p;
//#pragma

class TGA
{
public:
void Load(const char* pzFilename, bool flip);
void Delete(void);

int getWidth();
int getHeight();

char* getFilename();

char* pzFilename;

//private:
TGAHeader_t sHeader;
int* pBitmap;
};


#endif // TGA_H




//-----------------------------------------------------------------------------
//
// (C) 2003 by Sushi, All rights reserved.
//
// File : anim.h
//
// Author : Hans-Petter Harveg. <hp_harveg@hotmail.com>
//
// Description : Header for the anim class
//
// Note : (...)
//
//-----------------------------------------------------------------------------

#ifndef ANIM_H
#define ANIM_H

//-------------------------------------------------------------------------------
// Includes
//-------------------------------------------------------------------------------
#include <d3d9.h>
#include <d3dx9math.h>

#include "tga.h"

//-------------------------------------------------------------------------------
// Defines
//-------------------------------------------------------------------------------
#define ANIM_MAX_FRAMES 256
#define ANIM_PLAYONCE 0
#define ANIM_LOOP 1
#define ANIM_NUMVERTIES 4

#define ANIM_CUSTOMVERTEX D3DFVF_XYZ|D3DFVF_TEX1

struct AnimVertexStruct_t {
D3DXVECTOR3 position; // Position of the anim
FLOAT tu, tv; // The texture coordinates
};

typedef struct Frame {
TGA cTGA; // TGA file

LPDIRECT3DVERTEXBUFFER9 g_pVertexBuffer; // Vertexbuffer
LPDIRECT3DTEXTURE9 g_pTexture; // Texture

AnimVertexStruct_t sCustomVertex; // Vertex structure for the anim

float vDelay; // Frame delay
bool isNulltransparent; // transparancy boolean for the frame
} Frame_t, *pFrame;

//-------------------------------------------------------------------------------
// Anim class
//-------------------------------------------------------------------------------



class Anim {
public:
Anim(); // Constructor
Anim(char* pzFileName); // Constructor
virtual ~Anim(); // Destructor

void Load(char *pzFilename); // Loads the anim/sprite
void Render(void); // Render the anim/sprite
void Play(int vNewFlags); // Playes the anim/sprite

Frame_t* spFrame; // Anim frame info

void Anim::setViewport(int vX, int vY, int vWidth, int vHeight);
void setPosition(float vXPos,float vYPos,float vZPos);
void setRotation(float vXRot, float vYRot, float vZRot);
void setScale(float vScaleX, float vScaleY, float vScaleZ);
void setMaterial(float r, float g, float b, float a);

private:
void CalculateFrames( int iFrame );
void CalculateMatrixes(void); // Calculate transformations, rotations and size
void ParseScript(void); // Parse thrught the anim script

D3DXVECTOR3 sPosition;
D3DXVECTOR3 sRotation;
D3DXVECTOR3 sScale;

D3DMATERIAL9 sMaterial;

int vWidth,vHeight; // Size of anim/sprite

int isMaterial;

int vViewportWidth;
int vViewportHeight;

int vSTime;

int vCurrentFrame; // Current frame
bool isLooping;

int vFlags;

int nFrames; // Number of frames
};


#endif // ANIM_H

Share this post


Link to post
Share on other sites
It seems like it has nothing to do with the TGA class at all.. now I got anoter error:

C:\Documents and Settings\Hans-Petter Harveg\Mine dokumenter\Mine prosjekter\D3D9 Engine\anim.cpp(33) : error C2143: syntax error : missing ';' before 'PCH creation point'

Does this has anything to do with Visual Studio?

Share this post


Link to post
Share on other sites
pch means "pre-compiled header", and that error usually means that something is wrong with your class declaration or definition and the program can't compile it. once i had 32 pch creation errors, all for various sins i shall not mention. so check your classes and ensure everything matches. just out of curiosity, shouldn't the line (in the Anim class in anim.h) that reads :
void Anim::setViewport(params)
be simply
void setViewport(params) ?

Share this post


Link to post
Share on other sites

This topic is 4834 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this