View Single Post
  #5   Spotlight this post!  
Unread 02-18-2006, 11:11 AM
kevlarman kevlarman is offline
"why cant i install Linux?" guy
AKA: Roman Tetelman
None #0100
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Belmont, CA
Posts: 11
kevlarman is an unknown quantity at this point
Re: The silly syntax errors that won't go away!

actually the more traditional way to do that is
Code:
#ifndef _MY_HEADER_FILE_H_
#define _MY_HEADER_FILE_H_
//other stuff in the header goes here
#endif
and make sure that all variables are declared extern (and initialized in the .c file that owns them), otherwise each file will get its own copy of the variable.
EDIT:
forgot to mention that _MY_HEADER_FILE_H_ should be the name of the file it is in (in this case it would be myheaderfile.h), if two files have the same #define at the top, one will get ignored

Last edited by kevlarman : 02-18-2006 at 11:43 AM.