I've searched in a lot of foruns, including this one, to an answer to this error that is pissing me off. I know that it's about circular dependence, but i just can't make it work. Please take a look to the error message:
Making it shorter: "Ceu.h" calls "Iluminador.h"; "Iluminador.h" calls "Visualizador.h"; "Visualizador.h" calls another header, "main.h", witch calls almost all other headers to the project. Why only these two is giving errors back?
Thanks in advance
May 11th, 2009, 02:47 PM
ZuK
Re: Error C2061
Sometimes the use of forward declarations and use of pointers and references (instead of objects ) in the headers is the only way out of such situations.
Kurt
May 11th, 2009, 03:21 PM
jefranki
Re: Error C2061
Do all your header files have guards around them? By guard, I mean something like:
Code:
#ifndef SOMEFILE_H
#define SOMEFILE_H
// all the usual header file stuff should go in here
// between the #define and the #endif
#endif
This prevents most of the usual circular definition issues. Every single one of the header files you work with should have them (as a just-in-case).
May 12th, 2009, 02:47 PM
Salvador37
Re: Error C2061
Thanks, guys.
These guards resolved my problem. I didn't know how to deal with them, now its working.