🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Some Header Issues

Started by
0 comments, last by wolfenstein 17 years, 12 months ago
I'm pretty sure I know what the issue is, though I could be wrong. My headers seem to be conflicting with each other. I have two custom classes so far, both defined in seperate files. In one class's header I include the other custom class, and I also include it in my main file. I can remove any inclusion and the problem is fixed, but I wanted to know the cleanest and best way to organize my header inclusions. The files are as such: main.cpp

#include <cstdlib>
#include <windows.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>
#include "GameMap.h"
#include "Texture.h"
GameMap.cpp

#include "GameMap.h"
GameMap.h

#include <cstdlib>
#include <iostream>
#include <cstdarg>
#include "Texture.h"
Texture.cpp

#include "Texture.h"
Texture.h

no includes
That's the general strcture. Thanks in advance for any and all help ^^ Meow
Advertisement
Did you enclose your header file definitions with pre-processor directives to ensure that they only get included once?

For example in Texture.h you should have

#ifndef _TEXTURE_H_
#define _TEXTURE_H_

// The rest of the code goes here

#endif

Do the same thing in every header file but replace _TEXTURE_H_ with the appropriate file name
"Segata Sanshiro!!!"

This topic is closed to new replies.

Advertisement