Thread: msvc just ate one of my source files

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    411

    msvc just ate one of my source files

    I forgot I was in the debugger, hit build and the file that I had modified, but not saved is now gone. It was the source file to this header.

    I have a backup from a few days ago, but how can I find out why msvc crashed and what I can do to prevent it from happening again?


    Code:
    class cRenderEngine {
    public:
    	//Engine Functions
    	cRenderEngine();
    	~cRenderEngine();
    	void Init(HDC i);
    	void ClearScreen();
    	void Perspective3D(float fov,float near,float far,float width,float height);
    	void Perspective2D(RECT);
    	void Render3D();
    	void Render2D();
    	void RenderWireframe();
    	void RenderNormal();
    	void ResetRenderPosition();
    	void LoadCameraPosition();
    	void LoadCameraPosition(sVertex3f* eye, sVertex3f* focus);
    	void SetRenderPostion(float* m);
    	void Translate(sVertex3f location);
    	void Translate(float x, float y, float z);
    	void Rotate(sVertex3f rotation);
    	void DrawModel(unsigned int modelID);
    	void BindTexture(unsigned int textureID);
    	sTexture* LoadTexture(string path, short size, short size2);	//Loads a texture from file
    	sTexture* LoadTexture(float* data, short size, short size2);	//Loads texture from data 
    	sTexture* LoadTexture(string path, short size);					//Loads a texture from file
    	sTexture* LoadTexture(float* data, short size);					//Loads texture from data 
    	sTexture* LoadAlphaTexture(float* data, short size);				//Loads texture from data 
    	sTexture* LoadAlphaTexture(float* data, short size, short size2);	//Loads texture from data 
    	sTexture* LoadMonoTexture(float* data, short size);					//Loads texture from data 
    	sTexture* LoadMonoTexture(float* data, short size, short size2);	//Loads texture from data 
    	sModel* LoadTexturedGeometry(list<sTexturedTriangle>* tris, list<sTexturedQuad>* quads, sTexture* tex);	//Creates a display list from the passed polys
    	sModel* LoadBasicGeometry(list<sBasicTriangle>* tris, list<sBasicQuad>* quads);		//Creates a display list from the passed polys
    	void Screenshot();
    	void SwapFrameBuffer();
    	void DeleteModel(unsigned int a);
    	void ShiftUp(float v);
    	void ShiftLeft(float v);
    	void PurgeLumps();
    
    	//Primitave Draw Functions
    	void ApplyColor(float color[4]);
    	void DrawTexturedTriangle(sVertex3f* coords[3], sVertex2f texcoords[3], sVertex3f normal);
    	void DrawTexturedQuad(sVertex3f* coords[4], sVertex2f texcoords[4], sVertex3f normal);
    	void DrawTriangle(sVertex3f* coords[3], sVertex3f normal);
    	void DrawQuad(sVertex3f* coords[4], sVertex3f normal);
    	void DrawLine(sVertex3f* coords[2], float size);
    
    	//Utility Functions
    	bool PrintSplashScreen();
    	void PrintVersion();
    	void PrintFPS();
    	void PrintTerrainInfo(sTerrainType* ter);
    	void PrintLoadingScreen(string title);
    	void PrintLoadingScreen(string title, int max);
    	bool PrintGoodbyeMessage();
    	void PrintDebugInfo();
    	void AddDebugInfo(string info);
    	void AddDebugInfo(string* info);
    	void ClearDebugInfo();
    	void DrawCursor(short x, short y);
    	void DrawButton(sButton* button, unsigned int tex);
    	void DrawLabel(sLabel* label);
    	void DrawWheel(cSelectionWheel<sTerrainType*>* terrainWheel);
    	void DrawRadar();
    	void DrawResources();
    	unsigned int CreateTerrainQuad(float* height, sTexture* tex);
    
    	//Setters
    	void SetWindowSettings(sWindowSettings* s) { windowSettings = s; };
    
    	//Font Routines
    	bool LoadFont(string id_name, string font_name);	//Loads font with name to id
    	bool Print(string id_name, string text);					//Prints
    	bool Print(string id_name, string text, float x, float y);	//Translates then prints
    	void SetupFontSize(short width, short height, short weight);
    	void SetFontWidth(short i) { f_width = i; };		//Sets font param
    	void SetFontHeight(short i){ f_height = i; };		//Sets font param
    	void SetFontWeight(short i){ f_weight = i; };		//Sets font param
    	void SetFontItalic(DWORD i){ f_italic = i; };		//Sets font param
    	void SetFontUnderline(DWORD i){ f_underline = i; };	//Sets font param
    	void SetFontStrikeout(DWORD i){ f_strike = i; };	//Sets font param
    	void SetFontCharSet(DWORD i){ f_charset = i; };		//Sets font param
    	void SetFontQuality(DWORD i){ f_quality = i; };		//Sets font param
    	void ResetFontAttributes();
     
    	//debug functions
    	void DrawTextureTest(unsigned int tex);
    
    private:
    	//Font Functionality
    	short	GetFontID(string id_name);		//ID to # matcher function
    	string	fontName[MAX_FONTS];			//Font ID's
    	long	fontList[MAX_FONTS];			//Font DL's	
    	int		f_width,f_height,f_weight;		//Font Attribs
    	DWORD	f_italic,f_underline,f_strike;	//Font Attribs
    	DWORD	f_charset,f_quality;			//Font Attribs
    	int		loadedFonts;					//Font Counter
    
    	//Other
    	HDC hdc;
    	string buildNumberString;
    	string fpsString;
    	DWORD splashScreenTimer;
    	DWORD fpsTimer;
    	DWORD fpsCounter;
    	short splashScreenStage;
    	float splashScreenColor;
    	short loadingScreenType;
    	short loadingScreenCount;
    	DWORD loadingScreenTimer;
    	string loadingScreenString;
    	sTexture* defaultTexture;
    	unsigned int defaultModel;
    	list<sTexture*> loadedTextures;
    	list<sTexture*> loadedLumps;
    	list<string> debugInfo;
    	list<string*> dynamicDebugInfo;
    
    	//perspective params
    	double matrix2D[16];
    	double matrix3D[16];
    	short renderMode;
    	RECT view2D;
    	float fov3d;
    	float near3d;
    	float far3d;
    	float width3d;
    	float height3d;
    
    	sWindowSettings* windowSettings;
    };

  2. #2
    ---
    Join Date
    May 2004
    Posts
    1,379
    sucks to be you =)

  3. #3
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Could just be a once off problem. It may never happen again.
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  4. #4
    Registered User
    Join Date
    Sep 2003
    Posts
    25
    Once msvs6 crashed and all my source files was gone...

  5. #5
    mov.w #$1337,D0 Jeremy G's Avatar
    Join Date
    Nov 2001
    Posts
    704
    MSVC has an option to autosave all work before attempting to compile. Set that to on.
    c++->visualc++->directx->opengl->c++;
    (it should be realized my posts are all in a light hearted manner. And should not be taken offense to.)

  6. #6
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    I have had this happen before. I never figured it out. if you don't save the file, and you close the editor window the file could be gone.

    My solution was of course to pull a recent version back out of Source Safe. But you probably aren't hooked up to any version control system. All I can say is backup constantly. It's a strange bug.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  7. #7
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by FillYourBrain
    I have had this happen before. I never figured it out. if you don't save the file, and you close the editor window the file could be gone.
    ...
    All I can say is backup constantly. It's a strange bug.
    No, that's called a feature.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 10
    Last Post: 06-04-2009, 08:45 PM
  2. Working with multiple source files
    By abh!shek in forum C Programming
    Replies: 17
    Last Post: 06-03-2008, 11:23 AM
  3. Beginner Question: Multiple source files
    By ironfistchamp in forum C++ Programming
    Replies: 8
    Last Post: 07-16-2006, 02:19 PM
  4. Linker errors - Multiple Source files
    By nkhambal in forum C Programming
    Replies: 3
    Last Post: 04-24-2005, 02:41 AM
  5. odd errors from msvc std library files
    By blight2c in forum C++ Programming
    Replies: 6
    Last Post: 04-30-2002, 12:06 AM