By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,331 Members | 1,476 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,331 IT Pros & Developers. It's quick & easy.

'g_undo' was not declared in this scope

P: n/a
I get the following error:

editarea.cpp:
In member function `int Edit_Area::Mouse_Draw(int, int, unsigned
char)':
`g_undo' was not declared in this scope

The problem is that g_undo is there. It's in undo.h:

class S_Undo
{
//stuff removed
};
extern S_Undo *g_undo;

The include list of editarea.cpp:

#include <list>
#include <SDL/SDL.h>
#include "stmain.h"
#include "pixel.h"
#include "gprim.h"
#include "stile.h"
#include "area.h"
#include "editarea.h"
#include "brush.h"
#include "ctool.h"
#include "options.h"
#include "tileset.h"
#include "editor.h"
#include "grpdata.h"
#include "generic.h"
#include "icon.h"
#include "undo.h"

If I switch the places of icon.h and undo.h, I get an error telling
that
'g_edit1' of class Icon is not declared while g_undo doesn't give
an error. What is happening here? I'm using DevC++/gcc.

Oct 1 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Krice posted:
What is happening here? I'm using DevC++/gcc.
I can hazard a guess...

When I write multiple header files, I save myself time and effort by copy-
pasting the inclusion guards from one file to another.

The first thing I'd check is that you actually changed the name of the
inclusion guard macro for each file -- maybe two files have the same macro
name in them, and so only one of them is being included... ?

--

Frederick Gotham
Oct 1 '06 #2

P: n/a
Frederick Gotham wrote:
maybe two files have the same macro
name in them, and so only one of them is being included... ?
That was the case. icon.h had UNDO_H. Thanks!

Oct 1 '06 #3

P: n/a
Krice posted:
>maybe two files have the same macro
name in them, and so only one of them is being included... ?

That was the case. icon.h had UNDO_H. Thanks!

Yes, I do believe I'm feeling psychic today! :D

--

Frederick Gotham
Oct 1 '06 #4

P: n/a

"Frederick Gotham" <fg*******@SPAM.comwrote in message
news:uw*******************@news.indigo.ie...
Krice posted:
>>maybe two files have the same macro
name in them, and so only one of them is being included... ?

That was the case. icon.h had UNDO_H. Thanks!


Yes, I do believe I'm feeling psychic today! :D
I knew you were gonna say that!
Oct 2 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.