Click here to Skip to main content
15,921,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
why we put those lines when we are going to make a header file in C++ ?

#ifndef TIME1_H
#define TIME1_H
Posted

It is an include guard (see Wikipedia[^]), protects against the multiple inclusions of the same header.
The Microsoft compiler (and some others as well) provides the #pragma once directive for addressing the same problem.
 
Share this answer
 
Comments
fjdiewornncalwe 1-Nov-12 16:59pm    
+5.
It is a preprocessor designed to avoid the redeclaration of a specific item. In this case, if TIME_H was defined in a previously loaded header, then the compiler would throw a compilation error on a redefinition. The #ifndef simply means "If this isn't defined yet" then #define TIME1_H
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900