Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/24/12 11:41
Read: times


 
#187492 - Common to play with #define EXTERN
Responding to: ???'s previous message
The normal way to do what you try to do is:

globals.h
#ifndef MYHEADER_H
#define MYHEADER_H

#ifdef GLOBALS
#define EXTERN
#else
#define EXTERN extern
#endif

EXTERN int charlie;
EXTERN int benny;
...

#endif // MYHEADER_H


globals.c
#define GLOBALS
#include "myheader.h"


any.c
#include "myheader.h"



List of 15 messages in thread
TopicAuthorDate
const strings in C            01/01/70 00:00      
   Does not compile            01/01/70 00:00      
      my question was            01/01/70 00:00      
         Common to play with #define EXTERN            01/01/70 00:00      
            Common doesn't mean recommended            01/01/70 00:00      
               well I recommend it            01/01/70 00:00      
               No - not hard to maintain at all            01/01/70 00:00      
   C strings            01/01/70 00:00      
   Whats wrong with a header file?            01/01/70 00:00      
      nothing wrong, double work            01/01/70 00:00      
         It works, and has advantages            01/01/70 00:00      
         I got in a total absolute magnificent mess            01/01/70 00:00      
   thanks to everyone, and next question is            01/01/70 00:00      
      about (tables of) pointers to const strings            01/01/70 00:00      
         C++ and style            01/01/70 00:00      

Back to Subject List