Link to home
Start Free TrialLog in
Avatar of chsalvia
chsalvia

asked on

Include file conflict

When working with various header files, how can you prevent having to worry about which includes which, so you don't accidentally include something twice?

Is there some preprocessor command you can form?
SOLUTION
Avatar of amit_g
amit_g
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rajeev_devin
rajeev_devin

Another shorter version that can be used in VC++ is

// header.h
#pragma once

// Your code comes here
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It should have been

    #include "header.h"