   virtual class's runtime error  ...!?
  hi ..are anone have any idea about error.?#include <stdio.h>#include <vector>using namespace std ;class C3DS{public:struct stMaterial{char szName[256];struct{ unsigned char r,g,b ; }Colour;char szTextureFile[256];};struct stVert{float x, y, z;};struct stFace{   // 3 Sides of a triangle make a face.unsigned int A, B, C;int MaterialID;};struct stTex{float tu, tv;};struct stMesh{char    szMeshName[256];intiNumVerts;stVert* pVerts;intiNumFaces;stFace* pFaces;stTex*  pTexs;stMesh(){iNumVerts  = 0;pVerts= NULL;iNumFaces  = 0;pFaces= NULL;pTexs = NULL;}  };  protected: struct stChunk {  unsigned short ID;  unsigned int length;  unsigned int bytesRead; }; public: C3DS(void); ~C3DS(void);  bool Create(char* szFileName); void Release();public:  int m_iNumMeshs; vector<stMesh>m_pMeshs;  int m_iNumMaterials; vector<stMaterial> m_pMaterials; protected:  FILE* m_fp;  void ParseChunk   (stChunk* Chunk); void GetMaterialName   (stChunk* Chunk); void GetDiffuseColour  (stChunk* Chunk); void GetTexFileName    (stChunk* Chunk); void GetMeshObjectName (stChunk* Chunk); void ReadMeshTexCoords (stChunk* Chunk); void ReadMeshVertices  (stChunk* Chunk); void ReadMeshFaces(stChunk* Chunk); void ReadMeshMaterials (stChunk* Chunk); int GetString(char* pBuffer); void SkipChunk    (stChunk *pChunk); void ReadChunk    (stChunk *pChunk); };// Debugging Functionvoid debug_op(char *s);void DisplayRawData(C3DS* pObj);ERROR: C:\Documents and Settings\FC\Desktop\_test_lab\CLASS-1\Makefile.win [Build Error]  [CLASS_TEST_1.exe] Error 1 i dont hawe enough knowledge about virtual class.i cant imagine them how they works.so i need help.Thanks.
  And the error is?If it's that line at the end of the source block, that doesn't have anything to do with virtual functions. It looks like your makfile is broken. What compiler are you using?   ;  1) The error you are getting is not at runtime, it is at compile time.2) You have not used the "virtual" keyword anywhere in your code sample.3) I don't think you have posted the full error message (which would help us determine your problem).Consider:using std::string instead of char arrays to represent text in your program. replacing FILE pointers with std::fstream of the correct type.making the the file local to the function that loads the data.not prefixing structure names with "st" - it is pointlessreplacing (array pointer, size) pairs with std::vector instancesnot using "void" to indicate no parameters - it is pointlessnot placing "using namespace std" in header filesHope this helps [smile]   ;  i've using devc++.thanks but can you explain what is wrong with makefile.?i think you mean somemthing like command line options.?;  I mean whatever "Makefile.win" is. However, I'd listen to rip-off's points, maybe you're just not posting the correct error message.Off topic: Why are you using DevCpp anyway? It's quite out of date, and VC2005 Express can do everything it can do (and more), and you'll be able to use a lot of libraries you can't with DevCpp (Such as any DirectX SDK from the past 2 years or so...)   ;  No the error is jus this.anyway the project was have another errors but depending on this.so i created a new project for checking the bug.at end this projects just error is this.anyway isn't this class have anything wrong.?the original projects error was saying that somthıng is wrong about C3DS classabout msvc its compiling time is realy more then devc on my pc.and some other issues like configrations.   ;Quote:Original post by RSC_xNo the error is jus this.anyway the project was have another errors but depending on this.so i created a new project for checking the bug.at end this projects just error is this.anyway isn't this class have anything wrong.?the original projects error was saying that somthıng is wrong about C3DS classabout msvc its compiling time is realy more then devc on my pc.and some other issues like configrations.There's nothing wrong that I can see with the code you posted, but then it's just a header file, and there's no "real" code to go wrong.What was the original error? What does any of this have to do with virtual functions?   ;  ok you guys looks right.i tested it again and it looks like it trying to find this class on libraries.? Quote:int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int) { C3DS myObj; myObj.Create(FILENAME); DisplayRawData( &myObj); myObj.Release(); return 0;}  [Linker error] undefined reference to `C3DS::C3DS()'   [Linker error] undefined reference to `C3DS::Create(char*)'[Linker error] undefined reference to `DisplayRawData(C3DS*)'   [Linker error] undefined reference to `C3DS::Release()'   [Linker error] undefined reference to `C3DS::~C3DS()'   [Linker error] undefined reference to `C3DS::~C3DS()'  i remember devc don't like class's which hawe "::" signs sometimes.so is there any idea.? or should i forget this class and make my own new.?   ;  The compiler can't find the implementation of those functions. What file are they implemented in? Is that file added to your project (I'm not sure how "projects", etc work with DevCpp)?   ;  thanks steve it now just gives two errors.In function `void DisplayRawData(C3DS*)': 815 name lookup of `cc' changed for new ISO `for' scoping 797 using obsolete binding at `cc' void DisplayRawData(C3DS* pObj){ char buf[500]; for( int i=0; i<(pObj->m_iNumMeshs); i++ ) {  C3DS::stMesh* pMesh = &(pObj->m_pMeshs);   sprintf(buf, "Shape: %s\n", pMesh->szMeshName);  debug_op(buf);   sprintf(buf, "iNumFaces: %d\n", pMesh->iNumFaces);  debug_op(buf);  for(int cc=0; cc<pMesh->iNumFaces; cc++)  {   sprintf(buf, "\t %d, \t %d \t %d\n",  pMesh->pFaces[cc].A, pMesh->pFaces[cc].B, pMesh->pFaces[cc].C);   debug_op(buf);  }   sprintf(buf, "iNumVertices: %d\n", pMesh->iNumVerts);  debug_op(buf);  for(  cc=0; cc<(pMesh->iNumVerts); cc++)  {   sprintf(buf, "\t %.2f, \t %.2f \t %.2f\n",pMesh->pVerts[cc].x,pMesh->pVerts[cc].y,pMesh->pVerts[cc].z);   debug_op(buf);  }   if( pMesh->pTexs != NULL )  {   sprintf(buf, "iNumTex: %d\n", pMesh->iNumVerts);   debug_op(buf);   for(  cc=0; cc<pMesh->iNumVerts; cc++)   {    sprintf(buf, "\t %.2f, \t %.2f\n", pMesh->pTexs[cc].tu, pMesh->pTexs[cc].tv );    debug_op(buf);   }  }   if( pObj->m_iNumMaterials > 0 )  {   sprintf(buf, "Material vs Faces: %d\n", pMesh->iNumFaces);   debug_op(buf);   for(  cc=0; cc<pMesh->iNumFaces; cc++)   {    sprintf(buf, "\t MaterialID: %d", pMesh->pFaces[cc].MaterialID );    debug_op(buf);int ID = pMesh->pFaces[cc].MaterialID;    sprintf(buf, "\t, Name: %s\n", pObj->m_pMaterials[ID].szName);    debug_op(buf);   }  } }}