# code wont compile any more and ive gone crazy

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

## Recommended Posts

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..

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
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

##### Share on other sites
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..)

##### Share on other sites
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

##### Share on other sites
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?

##### Share on other sites
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?

##### Share on other sites
The problem is probably somewhere in the wereglobalincludes.h file.

##### Share on other sites
Quote:
 Original post by MTcliperror 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.

1. 1
2. 2
Rutin
18
3. 3
4. 4
5. 5

• 14
• 12
• 9
• 12
• 37
• ### Forum Statistics

• Total Topics
631431
• Total Posts
3000040
×