Ronaldo Mercado wrote:
>One way I have seen this solved is to have a #define, say '#define MAIN'
>
>On the header file "header.h" you would have a declaration and a definition 
>only if MAIN is defined, e.g.
>
>extern int y;  /* declaration */
>#ifdef MAIN
>int y;          /* definition */
>#endif
>
>Most c files would include "header.h" and main.c would do this instead
>
>#define MAIN
>#include "header.h"

After preprocessing that is exactly the same as this:

header.h:
extern int y;

main.c:
#include "header.h"
int y;

So just do that instead.

Björn Persson

Attachment: pgp4rdh5xchOV.pgp
Description: OpenPGP digital signatur

_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org

Reply via email to