Sign in to follow this  

Stupid syntax error in function prototype (i think)

This topic is 4379 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

Here is the error
c:\documents and settings\jonathan\desktop\renderengine\object.h(20) : error C4716: 'Object::GetRenderInformation' : must return a value
Here is Object.h (where the function is declared n stuff)
#ifndef OBJECT_H
#define OBJECT_H
#include "MS3D.h"
#include "ObjectFactory.h"
#include "ResourceManager.h"


enum OBJECTS
{
   SHIP_OBJECT
};

class Object
{
public:
	virtual ~Object() {}
	float locx, locy, locz;
	bool MarkedForDeletion;

	virtual MS3DModel *GetRenderInformation(){}
	virtual void GetPhysicsInformation(){}
	virtual void GetSoundInformation(){}
	virtual void Update(){}


};

class Ship : public Object
{
public:
	
	Ship(float x, float y, float z)
	{
		x = locx;
		y = locy;
		z = locz;
	}

	MS3DModel *GetRenderInformation()
	{
		return Models.Model1;
	}

	void GetPhysicsInformation()
	{
	
	}

	void GetSoundInformation()
	{
	
	}

	void Update()
	{
	
	}
protected:

	// Ship specific functions go here

};






#endif

I'm pretty sure its my syntax Theres 13 warnings accompanied with it, here they are...
--------------------Configuration: NeHeGL - Win32 Debug--------------------
Compiling...
Renderer.cpp
c:\program files\microsoft visual studio\vc98\include\utility(17) : warning C4786: '?$pair@Viterator@?$_Tree@HU?$pair@$$CBHPAVCreateObjectBase@?$ObjectFactory3@VObject@@MMMH@@@std@@U_Kfn@?$map@HPAVCreateObjectBase@?$ObjectFactory3@VObject@@MMMH@@U?$
less@H@std@@V?$allocator@PAVCreateObjectBase@?$ObjectFactory3@VObject@@MMMH@@@4@@2@U?$less@H@2@V?$allocator@PAVCreateObjectBase@?$ObjectFactory3@VObject@@MMMH@@@2@@std@@_N' : identifier was truncated to '255' characters in the browser information
        c:\program files\microsoft visual studio\vc98\include\map(93) : see reference to class template instantiation 'std::pair<class std::_Tree<int,struct std::pair<int const ,class ObjectFactory3<class Object,float,float,float,int>::CreateObjectB
ase *>,struct std::map<int,class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *,struct std::less<int>,class std::allocator<class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *> >::_Kfn,struct std::less
<int>,class std::allocator<class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *> >::iterator,bool>' being compiled
        c:\program files\microsoft visual studio\vc98\include\map(93) : while compiling class-template member function 'class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *&__thiscall std::map<int,class ObjectFactory3<class O
bject,float,float,float,int>::CreateObjectBase *,struct std::less<int>,class std::allocator<class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *> >::operator [](const int &) '
c:\program files\microsoft visual studio\vc98\include\utility(21) : warning C4786: '??0?$pair@Viterator@?$_Tree@HU?$pair@$$CBHPAVCreateObjectBase@?$ObjectFactory3@VObject@@MMMH@@@std@@U_Kfn@?$map@HPAVCreateObjectBase@?$ObjectFactory3@VObject@@MMMH@@
U?$less@H@std@@V?$allocator@PAVCreateObjectBase@?$ObjectFactory3@VObject@@MMMH@@@4@@2@U?$less@H@2@V?$allocator@PAVCreateObjectBase@?$ObjectFactory3@VObject@@MMMH@@@2@@std@@_N@std@@QAE@XZ' : identifier was truncated to '255' characters in the browser
 information
        c:\program files\microsoft visual studio\vc98\include\map(93) : see reference to class template instantiation 'std::pair<class std::_Tree<int,struct std::pair<int const ,class ObjectFactory3<class Object,float,float,float,int>::CreateObjectB
ase *>,struct std::map<int,class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *,struct std::less<int>,class std::allocator<class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *> >::_Kfn,struct std::less
<int>,class std::allocator<class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *> >::iterator,bool>' being compiled
        c:\program files\microsoft visual studio\vc98\include\map(93) : while compiling class-template member function 'class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *&__thiscall std::map<int,class ObjectFactory3<class O
bject,float,float,float,int>::CreateObjectBase *,struct std::less<int>,class std::allocator<class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *> >::operator [](const int &) '
c:\program files\microsoft visual studio\vc98\include\utility(23) : warning C4786: '??0?$pair@Viterator@?$_Tree@HU?$pair@$$CBHPAVCreateObjectBase@?$ObjectFactory3@VObject@@MMMH@@@std@@U_Kfn@?$map@HPAVCreateObjectBase@?$ObjectFactory3@VObject@@MMMH@@
U?$less@H@std@@V?$allocator@PAVCreateObjectBase@?$ObjectFactory3@VObject@@MMMH@@@4@@2@U?$less@H@2@V?$allocator@PAVCreateObjectBase@?$ObjectFactory3@VObject@@MMMH@@@2@@std@@_N@std@@QAE@ABViterator@?$_Tree@HU?$pair@$$CBHPAVCreateObjectBase@?$ObjectFac
tory3@VObject@@MMMH@@@std@@U_Kfn@?$map@HPAVCreateObjectBase@?$ObjectFactory3@VObject@@MMMH@@U?$less@H@std@@V?$allocator@PAVCreateObjectBase@?$ObjectFactory3@VObject@@MMMH@@@4@@2@U?$less@H@2@V?$allocator@PAVCreateObjectBase@?$ObjectFactory3@VObject@@
MMMH@@@2@@1@AB_N@Z' : identifier was truncated to '255' characters in the browser information
        c:\program files\microsoft visual studio\vc98\include\map(93) : see reference to class template instantiation 'std::pair<class std::_Tree<int,struct std::pair<int const ,class ObjectFactory3<class Object,float,float,float,int>::CreateObjectB
ase *>,struct std::map<int,class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *,struct std::less<int>,class std::allocator<class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *> >::_Kfn,struct std::less
<int>,class std::allocator<class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *> >::iterator,bool>' being compiled
        c:\program files\microsoft visual studio\vc98\include\map(93) : while compiling class-template member function 'class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *&__thiscall std::map<int,class ObjectFactory3<class O
bject,float,float,float,int>::CreateObjectBase *,struct std::less<int>,class std::allocator<class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *> >::operator [](const int &) '
c:\program files\microsoft visual studio\vc98\include\utility(25) : warning C4786: '??0?$pair@Viterator@?$_Tree@HU?$pair@$$CBHPAVCreateObjectBase@?$ObjectFactory3@VObject@@MMMH@@@std@@U_Kfn@?$map@HPAVCreateObjectBase@?$ObjectFactory3@VObject@@MMMH@@
U?$less@H@std@@V?$allocator@PAVCreateObjectBase@?$ObjectFactory3@VObject@@MMMH@@@4@@2@U?$less@H@2@V?$allocator@PAVCreateObjectBase@?$ObjectFactory3@VObject@@MMMH@@@2@@std@@_N@std@@QAE@ABU?$pair@$DCAB@$DCAC@@1@@Z' : identifier was truncated to '255' 
characters in the browser information
        c:\program files\microsoft visual studio\vc98\include\map(93) : see reference to class template instantiation 'std::pair<class std::_Tree<int,struct std::pair<int const ,class ObjectFactory3<class Object,float,float,float,int>::CreateObjectB
ase *>,struct std::map<int,class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *,struct std::less<int>,class std::allocator<class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *> >::_Kfn,struct std::less
<int>,class std::allocator<class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *> >::iterator,bool>' being compiled
        c:\program files\microsoft visual studio\vc98\include\map(93) : while compiling class-template member function 'class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *&__thiscall std::map<int,class ObjectFactory3<class O
bject,float,float,float,int>::CreateObjectBase *,struct std::less<int>,class std::allocator<class ObjectFactory3<class Object,float,float,float,int>::CreateObjectBase *> >::operator [](const int &) '
Generating Code...
c:\documents and settings\jonathan\desktop\renderengine\object.h(20) : error C4716: 'Object::GetRenderInformation' : must return a value
c:\program files\microsoft visual studio\vc98\include\utility(21) : warning C4786: 'std::pair<std::_Tree<int,std::pair<int const ,ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *>,std::map<int,ObjectFactory3<Object,float,float,float,
int>::CreateObjectBase *,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *> >::_Kfn,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *> >::iterator,bool>::pair<
std::_Tree<int,std::pair<int const ,ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *>,std::map<int,ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float
,int>::CreateObjectBase *> >::_Kfn,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *> >::iterator,bool>' : identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\xmemory(34) : warning C4786: 'std::_Tree<int,std::pair<int const ,ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *>,std::map<int,ObjectFactory3<Object,float,float,float,int>::Crea
teObjectBase *,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *> >::_Kfn,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *> >::_Nil' : identifier was truncate
d to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\xmemory(34) : warning C4786: 'std::_Tree<int,std::pair<int const ,ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *>,std::map<int,ObjectFactory3<Object,float,float,float,int>::Crea
teObjectBase *,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *> >::_Kfn,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *> >::_Nilrefs' : identifier was trun
cated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\xmemory(34) : warning C4786: 'std::pair<std::_Tree<int,std::pair<int const ,ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *>,std::map<int,ObjectFactory3<Object,float,float,float,
int>::CreateObjectBase *,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *> >::_Kfn,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *> >::iterator,bool>' : ide
ntifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\xmemory(34) : warning C4786: 'std::_Tree<int,std::pair<int const ,ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *>,std::map<int,ObjectFactory3<Object,float,float,float,int>::Crea
teObjectBase *,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *> >::_Kfn,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *> >' : identifier was truncated to '
255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\xmemory(34) : warning C4786: 'std::_Tree<int,std::pair<int const ,ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *>,std::map<int,ObjectFactory3<Object,float,float,float,int>::Crea
teObjectBase *,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *> >::_Kfn,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *> >::const_iterator' : identifier wa
s truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\xmemory(34) : warning C4786: 'std::_Tree<int,std::pair<int const ,ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *>,std::map<int,ObjectFactory3<Object,float,float,floaSkipping... 
(no relevant changes detected)
NeHeGL.cpp
Scene_Object_Manager.cpp
t,int>::CreateObjectBase *,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *> >::_Kfn,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *> >::iterator' : identif
ier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\xmemory(34) : warning C4786: 'std::_Tree<int,std::pair<int const ,ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *>,std::map<int,ObjectFactory3<Object,float,float,float,int>::Crea
teObjectBase *,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *> >::_Kfn,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *> >::_Node' : identifier was truncat
ed to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\xmemory(34) : warning C4786: 'std::_Tree<int,std::pair<int const ,ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *>,std::map<int,ObjectFactory3<Object,float,float,float,int>::Crea
teObjectBase *,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *> >::_Kfn,std::less<int>,std::allocator<ObjectFactory3<Object,float,float,float,int>::CreateObjectBase *> >::_Redbl' : identifier was trunca
ted to '255' characters in the debug information
Error executing cl.exe.
Creating browse info file...

NeHeGL.exe - 1 error(s), 13 warning(s)

Share this post


Link to post
Share on other sites
Ouch, looks like something gone bad to do with the stl. I can't be bothered reading all that, but my guess is that the MS3DModel class (or struct?) has various stl containers in it, and they're not being used right or something..

In fact... perhaps your problem lies here:
c:\program files\microsoft visual studio\vc98\

Share this post


Link to post
Share on other sites
Is it that stupid map include file?

<map>????

Wanna see my MS3D Header/cpp?

MS3D.h

#ifndef MS3D_H
#define MS3D_H
#include <windows.h>
#include <gl\glaux.h>
#include <vector>



class MS3DModel
{
public:

MS3DModel();

virtual ~MS3DModel();

struct Vertex
{
char BoneID;
float Location[3];
};

int NumVertices;
Vertex *Vertices;

struct Triangle
{
float VertexNormals[3][3];
float Textures1[3], Textures2[3];
int VertexIndices[3];
};

int NumTriangles;
Triangle *Triangles;

struct Mesh
{
int MaterialIndex;
int NumTriangles;
int *TriangleIndices;
};

int NumMeshes;
Mesh *Meshes;

struct Material
{
float Ambient[4], Diffuse[4], Specular[4], Emissive[4];
float Shininess;
GLuint Texture;
char *TextureFilename;
};

int NumMaterials;
Material *Materials;

bool LoadModelData( const char *filename );
void ReloadTextures();
void DrawMS3DModels();
};

#endif







MS3D.CPP


#include <windows.h> // Header File For Windows
#include <fstream.h>
#include "TextureManager.h"
#include "MS3D.h"

MS3DModel::MS3DModel()
{
NumMeshes = 0;
Meshes = NULL;
NumMaterials = 0;
Materials = NULL;
NumTriangles = 0;
Triangles = NULL;
NumVertices = 0;
Vertices = NULL;
}

MS3DModel::~MS3DModel()
{
int i;
for ( i = 0; i < NumMeshes; i++ )
delete[] Meshes[i].TriangleIndices;
for ( i = 0; i < NumMaterials; i++ )
delete[] Materials[i].TextureFilename;

NumMeshes = 0;//
if ( Meshes != NULL )
{
delete[] Meshes;
Meshes = NULL;
}

NumMaterials = 0;
if ( Materials != NULL )
{
delete[] Materials;
Materials = NULL;
}

NumTriangles = 0;
if ( Triangles != NULL )
{
delete[] Triangles;
Triangles = NULL;
}

NumVertices = 0;
if ( Vertices != NULL )
{
delete[] Vertices;
Vertices = NULL;
}
}

/*
MS3D STRUCTURES
*/


// byte-align structures
#ifdef _MSC_VER
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error you must byte-align these structures with the appropriate compiler directives
#endif

typedef unsigned char byte;
typedef unsigned short word;

// File header
struct MS3DHeader
{
char m_ID[10];
int m_version;
} PACK_STRUCT;

// Vertex information
struct MS3DVertex
{
byte m_flags;
float m_vertex[3];
char m_boneID;
byte m_refCount;
} PACK_STRUCT;

// Triangle information
struct MS3DTriangle
{
word m_flags;
word m_vertexIndices[3];
float m_vertexNormals[3][3];
float m_s[3], m_t[3];
byte m_smoothingGroup;
byte m_groupIndex;
} PACK_STRUCT;

// Material information
struct MS3DMaterial
{
char m_name[32];
float m_ambient[4];
float m_diffuse[4];
float m_specular[4];
float m_emissive[4];
float m_shininess; // 0.0f - 128.0f
float m_transparency; // 0.0f - 1.0f
byte m_mode; // 0, 1, 2 is unused now
char m_texture[128];
char m_alphamap[128];
} PACK_STRUCT;

// Joint information
struct MS3DJoint
{
byte m_flags;
char m_name[32];
char m_parentName[32];
float m_rotation[3];
float m_translation[3];
word m_numRotationKeyframes;
word m_numTranslationKeyframes;
} PACK_STRUCT;

// Keyframe data
struct MS3DKeyframe
{
float m_time;
float m_parameter[3];
} PACK_STRUCT;

// Default alignment
#ifdef _MSC_VER
# pragma pack( pop, packing )
#endif

#undef PACK_STRUCT

bool MS3DModel::LoadModelData(const char *filename)
{
ifstream inputFile( filename, ios::in | ios::binary | ios::nocreate );
if ( inputFile.fail())
return false; // "Couldn't open the model file."

inputFile.seekg( 0, ios::end );
long fileSize = inputFile.tellg();
inputFile.seekg( 0, ios::beg );

byte *pBuffer = new byte[fileSize];
inputFile.read( pBuffer, fileSize );
inputFile.close();

const byte *pPtr = pBuffer;
MS3DHeader *pHeader = ( MS3DHeader* )pPtr;
pPtr += sizeof( MS3DHeader );

if ( strncmp( pHeader->m_ID, "MS3D000000", 10 ) != 0 )
return false; // "Not a valid Milkshape3D model file."

if ( pHeader->m_version < 3 || pHeader->m_version > 7 )
return false; // "Unhandled file version. Milkshape3D Version 1.3 through 1.7 is supported." :)

int nVertices = *( word* )pPtr;
NumVertices = nVertices;
Vertices = new Vertex[nVertices];
pPtr += sizeof( word );

int i;
for ( i = 0; i < nVertices; i++ )
{
MS3DVertex *pVertex = ( MS3DVertex* )pPtr;
Vertices[i].BoneID = pVertex->m_boneID;
memcpy( Vertices[i].Location, pVertex->m_vertex, sizeof( float )*3 );
pPtr += sizeof( MS3DVertex );
}

int nTriangles = *( word* )pPtr;
NumTriangles = nTriangles;
Triangles = new Triangle[nTriangles];
pPtr += sizeof( word );

for ( i = 0; i < nTriangles; i++ )
{
MS3DTriangle *pTriangle = ( MS3DTriangle* )pPtr;
int vertexIndices[3] = { pTriangle->m_vertexIndices[0], pTriangle->m_vertexIndices[1], pTriangle->m_vertexIndices[2] };
float t[3] = { 1.0f-pTriangle->m_t[0], 1.0f-pTriangle->m_t[1], 1.0f-pTriangle->m_t[2] };
memcpy( Triangles[i].VertexNormals, pTriangle->m_vertexNormals, sizeof( float )*3*3 );
memcpy( Triangles[i].Textures1, pTriangle->m_s, sizeof( float )*3 );
memcpy( Triangles[i].Textures2, t, sizeof( float )*3 );
memcpy( Triangles[i].VertexIndices, vertexIndices, sizeof( int )*3 );
pPtr += sizeof( MS3DTriangle );
}

int nGroups = *( word* )pPtr;
NumMeshes = nGroups;
Meshes = new Mesh[nGroups];
pPtr += sizeof( word );
for ( i = 0; i < nGroups; i++ )
{
pPtr += sizeof( byte ); // flags
pPtr += 32; // name

word nTriangles = *( word* )pPtr;
pPtr += sizeof( word );
int *pTriangleIndices = new int[nTriangles];
for ( int j = 0; j < nTriangles; j++ )
{
pTriangleIndices[j] = *( word* )pPtr;
pPtr += sizeof( word );
}

char materialIndex = *( char* )pPtr;
pPtr += sizeof( char );

Meshes[i].MaterialIndex = materialIndex;
Meshes[i].NumTriangles = nTriangles;
Meshes[i].TriangleIndices = pTriangleIndices;
}

int nMaterials = *( word* )pPtr;
NumMaterials = nMaterials;
Materials = new Material[nMaterials];
pPtr += sizeof( word );
for ( i = 0; i < nMaterials; i++ )
{
MS3DMaterial *pMaterial = ( MS3DMaterial* )pPtr;
memcpy( Materials[i].Ambient, pMaterial->m_ambient, sizeof( float )*4 );
memcpy( Materials[i].Diffuse, pMaterial->m_diffuse, sizeof( float )*4 );
memcpy( Materials[i].Specular, pMaterial->m_specular, sizeof( float )*4 );
memcpy( Materials[i].Emissive, pMaterial->m_emissive, sizeof( float )*4 );
Materials[i].Shininess = pMaterial->m_shininess;
Materials[i].TextureFilename = new char[strlen( pMaterial->m_texture )+1];
strcpy( Materials[i].TextureFilename, pMaterial->m_texture );
pPtr += sizeof( MS3DMaterial );
}

ReloadTextures();

delete[] pBuffer;

return true;
}

void MS3DModel::ReloadTextures()
{
for ( int i = 0; i < NumMaterials; i++ )
if ( strlen( Materials[i].TextureFilename ) > 0 )
Materials[i].Texture = LoadGLTexture( Materials[i].TextureFilename );
else
Materials[i].Texture = 0;
}

void MS3DModel::DrawMS3DModels()
{
GLboolean texEnabled = glIsEnabled( GL_TEXTURE_2D );

// Draw by group
for ( int i = 0; i < NumMeshes; i++ )
{
int materialIndex = Meshes[i].MaterialIndex;
if ( materialIndex >= 0 )
{
glMaterialfv( GL_FRONT, GL_AMBIENT, Materials[materialIndex].Ambient );
glMaterialfv( GL_FRONT, GL_DIFFUSE, Materials[materialIndex].Diffuse );
glMaterialfv( GL_FRONT, GL_SPECULAR, Materials[materialIndex].Specular );
glMaterialfv( GL_FRONT, GL_EMISSION, Materials[materialIndex].Emissive );
glMaterialf( GL_FRONT, GL_SHININESS, Materials[materialIndex].Shininess );

if ( Materials[materialIndex].Texture > 0 )
{
glBindTexture( GL_TEXTURE_2D, Materials[materialIndex].Texture );
glEnable( GL_TEXTURE_2D );
}
else
glDisable( GL_TEXTURE_2D );
}
else
{
// Material properties?
glDisable( GL_TEXTURE_2D );
}

glBegin( GL_TRIANGLES );
{
for ( int j = 0; j < Meshes[i].NumTriangles; j++ )
{
int triangleIndex = Meshes[i].TriangleIndices[j];
const Triangle* pTri = &Triangles[triangleIndex];

for ( int k = 0; k < 3; k++ )
{
int index = pTri->VertexIndices[k];

glNormal3fv( pTri->VertexNormals[k] );
glTexCoord2f( pTri->Textures1[k], pTri->Textures2[k] );
glVertex3fv( Vertices[index].Location );
}
}
}
glEnd();
}

if ( texEnabled )
glEnable( GL_TEXTURE_2D );
else
glDisable( GL_TEXTURE_2D );
}





///////////////////////////////////////////////////////////////////////////////
// This is a pragma ignores the many warnings Visual C++ 6.0 gives when using
// the STL map container.
///////////////////////////////////////////////////////////////////////////////
#pragma warning (disable: 4786)


#include <map>
#include "MacroRepeat.h"


///////////////////////////////////////////////////////////////////////////////
// This is a work-around for those non-compliant compilers that do not support
// 'explicit template argument specification' for member functions, such as
// Visual C++ 6.0. It's not pretty syntax for the user, but at least it works.
///////////////////////////////////////////////////////////////////////////////
template<typename Type>
struct Type2Type
{
typedef Type OriginalType;
};


///////////////////////////////////////////////////////////////////////////////
// Because some compilers, such as Visual C++ 6.0, do not support partial
// template specialization we must create seperate ObjectFactory classes, one
// for each constructor parameter we allow the user to use.
///////////////////////////////////////////////////////////////////////////////
#define OBJECT_FACTORY(num)
template<typename BaseClassType MACRO_LIST_APPEND(num, MACRO_TEMPLATE_PARAMETER), typename UniqueIdType>
class ObjectFactory##num
{
protected:
class CreateObjectBase
{
public:
virtual ~CreateObjectBase() {}
virtual BaseClassType *operator()(MACRO_LIST(num, MACRO_FUNCTION_PARAMETER)) = 0;
};

template<typename ClassType>
class CreateObject : public CreateObjectBase
{
public:
BaseClassType *operator()(MACRO_LIST(num, MACRO_FUNCTION_PARAMETER))
{
return new ClassType MACRO_BEGIN_PAREN(num, MACRO_EMPTY_MACRO) MACRO_LIST(num, MACRO_FUNCTION_ARGUMENT) MACRO_END_PAREN(num, MACRO_EMPTY_MACRO); }
};

public:
typedef typename std::map<UniqueIdType, CreateObjectBase*>::const_iterator ConstIterator;
typedef typename std::map<UniqueIdType, CreateObjectBase*>::iterator Iterator;

~ObjectFactory##num()
{
Iterator iter = m_object_creator.begin();

while (iter != m_object_creator.end())
{
delete (*iter).second;
++iter;
}
}

template<typename ClassType>
bool Register(UniqueIdType unique_id, Type2Type<ClassType>)
{
if (m_object_creator.find(unique_id) != m_object_creator.end())
return false;

m_object_creator[unique_id] = new CreateObject<ClassType>;

return true;
}

bool Unregister(UniqueIdType unique_id)
{
Iterator iter = m_object_creator.find(unique_id);

if (iter != m_object_creator.end())
{
delete (*iter).second;
m_object_creator.erase(iter);

return true;
}

return false;
}

BaseClassType *Create(UniqueIdType unique_id MACRO_LIST_APPEND(num, MACRO_FUNCTION_PARAMETER))
{
Iterator iter = m_object_creator.find(unique_id);

if (iter == m_object_creator.end())
return NULL;

return ((*iter).second)->operator()(MACRO_LIST(num, MACRO_FUNCTION_ARGUMENT));
}

ConstIterator GetBegin() const
{
return m_object_creator.begin();
}

Iterator GetBegin()
{
return m_object_creator.begin();
}

ConstIterator GetEnd() const
{
return m_object_creator.end();
}

Iterator GetEnd()
{
return m_object_creator.end();
}

protected:
std::map<UniqueIdType, CreateObjectBase*> m_object_creator;
};

MACRO_REPEAT(16, OBJECT_FACTORY)
#undef OBJECT_FACTORY

#endif


Share this post


Link to post
Share on other sites
virtual MS3DModel *GetRenderInformation(){} <-- This is your error.

You define th function instead of only declaring it. Then you redefine it later. The compiler is confused. A declaration would look like:

virtual MS3DModel *GetRenderInformation();

As for the warning, they are caused by your ancient compiler. Consider upgrading to the free Visual Studio .NET Express Editions.

Share this post


Link to post
Share on other sites
No, it must be more syntax errors...


#ifndef OBJECT_H
#define OBJECT_H
#include "MS3D.h"
#include "ObjectFactory.h"
#include "ResourceManager.h"


enum OBJECTS
{
SHIP_OBJECT
};

class Object
{
public:
virtual ~Object() {}
float locx, locy, locz;
bool MarkedForDeletion;

virtual MS3DModel *GetRenderInformation();
virtual void GetPhysicsInformation();
virtual void GetSoundInformation();
virtual void Update();


};

class Ship : public Object
{
public:

Ship(float x, float y, float z)
{
x = locx;
y = locy;
z = locz;
}

virtual MS3DModel *GetRenderInformation()
{
return Models.Model1;
}

virtual void GetPhysicsInformation()
{

}

virtual void GetSoundInformation()
{

}

virtual void Update()
{

}

protected:

// Cross specific functions go here

};





#endif


Errors

Renderer.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Object::Update(void)" (?Update@Object@@UAEXXZ)
Renderer.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Object::GetSoundInformation(void)" (?GetSoundInformation@Object@@UAEXXZ)
Renderer.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Object::GetPhysicsInformation(void)" (?GetPhysicsInformation@Object@@UAEXXZ)
Renderer.obj : error LNK2001: unresolved external symbol "public: virtual class MS3DModel * __thiscall Object::GetRenderInformation(void)" (?GetRenderInformation@Object@@UAEPAVMS3DModel@@XZ)
Debug/NeHeGL.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
Creating browse info file...

NeHeGL.exe - 5 error(s), 13 warning(s)

Share this post


Link to post
Share on other sites
Your pure virtual functions need to be followed by '= 0'.


virtual MS3DModel *GetRenderInformation() = 0;
virtual void GetPhysicsInformation() = 0;
virtual void GetSoundInformation() = 0;
virtual void Update() = 0;

Share this post


Link to post
Share on other sites
OMG IT COMPILED!!!

This is what I ultimately did...

You'll like this...



ObjectFactory3<Object, float, float, float, int> ship_factory;


// Register Ship Objects with the object factory class
ship_factory.Register(SHIP_OBJECT, Type2Type<Ship>());


// We can instantiated the proper Ship Object class, just by referencing its
// unique identifier
Object *Ship1 = ship_factory.Create(SHIP_OBJECT, 83.0f, 14.2f, 54.4f);

Share this post


Link to post
Share on other sites

This topic is 4379 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