View Single Post
Old Apr 27th, 2005, 10:14 AM   #1
some1
Programmer
 
Join Date: Dec 2004
Posts: 50
Rep Power: 4 some1 is on a distinguished road
Including header files

How to prevent header files from being included twice?
My code is messed up and I need to include lots of .h files in other files so I get errors from the linker that X is already defined in x.obj file.

I tried using inclusion guards like this:

#ifndef INC_HEADER1
#define INC_HEADER1

<file content goes here>

#endif

and also tried

#pragma once

but i still get the same errors
But even if i include e.g windows.h or string.h a hundred times i never get linker errors about them.

help?
some1 is offline   Reply With Quote