Re: How to deal with large number of bugs related to the, "multiple definition of..." issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

> The most common fix I used was, using "extern" in all but one place.
> Well I guess what I was looking for was for us non-C/C++ programmers. :)
> I can grep the source and arbitrarily choose which one not to use extern with, but is there a right way?

I would like to see an example package where you experience this problem.

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"

Thanks,

Ronaldo



_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux