Sign in to follow this  
MTclip

code wont compile any more and ive gone crazy

Recommended Posts

MTclip    242
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 this post


Link to post
Share on other sites
SiCrane    11839
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 this post


Link to post
Share on other sites
nmi    978
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.

Share this post


Link to post
Share on other sites
MTclip    242
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 this post


Link to post
Share on other sites
dotproduct    180
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 this post


Link to post
Share on other sites
MTclip    242
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 this post


Link to post
Share on other sites
hplus0603    11356
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 this post


Link to post
Share on other sites
MTclip    242
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 this post


Link to post
Share on other sites
MumbleFuzz    188
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.

Share this post


Link to post
Share on other sites
nullsquared    126
As Sicrane said, your problem is most likely in wereglobalincludes.h. If you have a class or struct in there make sure it has a ; on the end of the definition... Ex: class Foo { void FooBar(); };.

Share this post


Link to post
Share on other sites
MTclip    242
well i finally got it to compile again...

the reason it would not compile does not really make sense to me but heres what was goin on ... in case any one cares ;P

the problem was between Object class and my Logger class
at first i thought that it may have been a cyclic thing, but i changed Logger so it did not inherit from Object.. same problem occured.. basically for some reason the Logger can not have Logger.h header included...

Here is the weird partjust by putting the #include Logger.h in the object class it caused c++ standard files to error such as..
excpt.h
stdarg.h
BaseTsd.h
... and many more

Share this post


Link to post
Share on other sites

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