code wont compile any more and ive gone crazy

Started by
10 comments, last by MTclip 18 years, 5 months ago
i know there are posts like this all the time (ive read some, but they did not help) my question is this.. is there ever a reason that code would just not compile any more... I am using msvc++ 2003 ... basically i changed like five lines of code (moved them from one file to another ) then wham.. I get about 1300 errors.. so i move it back...but the errors are still there.. not even a clean build fixes it. all the errors are saying my class are undefined.. ive spent the last 2 hours trying to figure out whats going on... so ive decided its not my fault(even though i know it is) but i feel its at least worth asking... sorry for the retard question.. thanks..
Advertisement
Things can blow up suddenly if you accidently deleted or inserted a {, } or ; in the wrong place. Other than that, I don't think we can be much help.
Try to clean your project, remove precompiled headers and rebuild everything.
Check if you are editing the correct file, i.e. there isn't a second file with this name in your project. Maybe insert #error in your header file to see if it is parsed.
yeah, that is totally what i think it is but i just cant find it...
There should really be a "I SCREWED MY CODE UP REAL BAD SO FIX IT" button

;P
Source control is nice to have :)

Quote:
my question is this.. is there ever a reason that code would just not compile any more...


Yes, there's a reason: You made a mistake somewhere ;)

Quote:
all the errors are saying my class are undefined..


Are you using namespaces, and forgot to add them in the new file?
I have no other ideas.. (other than what SiCrane said..)
well i found something and i dont even know what its saying

C2040: 'WereModel::GetMaterial' : 'int *(void)' differs in levels of indirection from 'void (void)'

the actuall function it complaning about looks like this
WereMaterial * GetMaterial(){return m_pMaterial;}

i know that this is not the root of my prob but its just looks strange
First: I agree that source control is a Good Thing. If something blows up, you can always just back out to the last good configuration you checked in.


Second, here's how to diagnose your problem:

After you're done building, click on the "Output" window (no, not the "Tasks" window, the real build output window).

Scroll to the very top, and find the first error message that the compiler printed out.

What does that error message say?
enum Bool { True, False, FileNotFound };
ok it does not really make sense why it says that to me but here it is

error C2146: syntax error : missing ';' before identifier 'm_timer'

here is what the code looks like up the error

#pragma once#define WIN32_LEAN_AND_MEAN#define VC_EXTRALEAN#include <windows.h>#include <d3d9.h>#include <d3dx9.h>#include <fstream>#include <string>#include "wereglobalincludes.h"class WereEngine{public:	WereTimer				m_timer;


also is there a way to specify the order in which files get compiled?
does it matter?
The problem is probably somewhere in the wereglobalincludes.h file.
Quote:Original post by MTclip
error C2146: syntax error : missing ';' before identifier 'm_timer'
You're possibly missing a ';' after a class or struct definition in another file. When I was first learning C++ I found those particularly easy to leave out.
MumbleFuzz

This topic is closed to new replies.

Advertisement