Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Mat1515

#ifndef _MAIN_H? #define _MAIN_H? #endif ?

This topic is 5401 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What are these #ifndef _MAIN_H? #define _MAIN_H? #endif ? doing and how do i use them properly. I see them popping up alot

Share this post


Link to post
Share on other sites
Advertisement
They're inclusion guards, to prevent things from being declared more than once if they appear in a file.

For example, if you put:
#include "Log.h"

Inside of SomeClass.h, then include SomeClass.h in a .cpp file where Log.h is already defined, you don't get a bunch of errors spit back at you.

Okay, that sounds stupid =P

Log.h:
- class CLog;
SomeClass.h
- #include "Log.h"
- class SomeClass;
SomeCPP.cpp
- #include "Log.h"
- #include "SomeClass.h"

No errors about how CLog is already declared.

[edited by - GroZZleR on February 29, 2004 2:20:08 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!