|
-
Apr 12th, 2001, 12:42 AM
#1
Thread Starter
Addicted Member
any idea of there is a way to check to see if a file has already been included.
I have two C files that both share a header file and it seems silly to #include <studio.h> in both.
Any ideas?
-
Apr 12th, 2001, 02:06 AM
#2
Lively Member
you can just put the #include <stdio.h> in the header file that they both share.
-
Apr 12th, 2001, 04:14 AM
#3
Monday Morning Lunatic
You may have noticed that all (properly-written!) header files have something like:
Code:
#ifndef __HEADER_H__ // replace with mangled filename
#define __HEADER_H__
/* code here */
#endif
This works, at the header level, to prevent them being included twice. Just go right ahead and include anything you want in any file
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|