I have two header files, animation.h and hero.h,
here is the code for animation.h:
#include <SFML/Graphics.hpp>
#include <iostream>
#include "hero.h"
#ifndef ANIMATION
#define ANIMATION
//Class
#endif
And for hero.h:
#include <SFML/Graphics.hpp>
#include <iostream>
#include "animation.h"
#ifndef HERO
#define HERO
//Class
#endif
I get the error message #include file "" includes itself even when using include guards.
I am new to using include guards and such so this may be a very trivial mistake.
Thanks for any help
You should put the header guards before anything else.
On
gccandMSCyou can also useinstead. Probably also on other more modern compilers. Simpliy put this at the top of your include, instead of the
#ifdef....animation.hhero.hOr
animation.h