[Snort-users] include question

Matt Kettler mkettler at ...4108...
Wed Jan 30 12:51:09 EST 2002


This is a bit "how to program correctly 101"ish, but here goes..

Each header also has multi-include protection defines. Any good programer 
adds these to every header file, every time. Heck, there are lots of 
development tools, scripts, etc which make these for you automatically.

for example plugbase.h has:

#ifndef __PLUGBASE_H__
#define __PLUGBASE_H__

(insert actual header file contents here)

#endif /* __PLUGBASE_H__ */


Which essentially causes the second include of plugbase.h to be 
preprocessed away into nothing since the second time around __PLUGBASE_H__ 
is defined.

I'd check to make sure the header for the preprocessor you are playing with 
is also properly written with multi-include protections.


At 01:37 PM 1/30/2002 -0600, Steve Halligan wrote:
>Each preprocessor includes its own header file.
>Each preprocessor also includes snort.h.
>snort.h includes plugbase.h.
>plugbase.h includes all the preprocessor headers.
>Isn't this redundant?
>I ask because a struct in the header for the preprocessor I was playing with
>caused a error while compiling, something about declaring it twice.  If the
>above is true, I can see why.





More information about the Snort-users mailing list