CyberSlug Rules!

Beginner Programming CMPS060

Prof. Paulo Franca

Home

Syllabus

Login

Objects

Download

Staff only

Avoid multiple inclusions!

a header file may be included more than once!

this may cause errors!

the column on the right shows how to avoid this.

// this is file one.h
#include "some.h"
void one()
{
...
}
#ifndef ONE_H
#define ONE_H
<program goes here>
#endif
// this is file some.h
void some()
{
...
}
#ifndef SOME_H
#define SOME_H
<program goes here>
#endif
// this is main.cpp
#include "some.h"
#include "one.h"
void mainprog()
{
...
}