Which one is the correct one? It seems like each and every one of those, which I tested, fail at compile time (for example: loc is not a member of ns or that there is a semicolon missing before *)
P.S As a side note - there was a very insightful article on this site that basically said "forward declare if the thing you want to use is of type* or type&". However, when I wanted to forward declare
extern enum_type& var;
the compiler complains. Do I have to include the entire header for such occurences? The compiler doesn't need to know it's size because the var itself is just a memory address :-|
> fail at compile time
bother yourself to copy-paste the error message.
> that basically said "forward declare if the thing you want to use is of type* or type&
forward declare the class.
the compiler needs to know that `enum_type' is a class
Sorry for not posting the errors :) I thought a more general way of describing the problem would help not to localise the issue for future users, but anyway.
globals.h (includes classes.h)
1 2 3 4
externint settings[];
namespace lang {
extern localisation* current_lang; // at this line
}
current_lang is defined in globals.cpplang::localisation* current_lang = NULL;
classes.h
1 2 3 4 5 6
namespace lang {
class localisation {
public:
// .... //
}
}
Error: error C2143: syntax error: missing ';' before '*'
Okay, I did a cleanup of my header repository and divided my declarations into smaller, more strategic headers (without any circular dependecies).
I almost got everything right, except for 3 unresolved external symbols :(
Error
LNK2001 unresolved external symbol "class lang::localisation lang::current_lang LNK2001 unresolved external symbol "class lang::localisation lang::l_english LNK2001 unresolved external symbol "class lang::localisation lang::l_polish
This is my include chain for word.obj (at least that's how it is called by the compiler) which was the first to be linked by the Linker I guess, and failed.