'g_undo' was not declared in this scope

K

Krice

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

Frederick Gotham

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

Krice

Frederick said:
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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top