Issues with config.h

Robert Kennedy amtor at hotmail.com
Thu Aug 4 13:36:35 UTC 2022


I am working on creating a new port that uses its own config.h.  See attached.  The project compiles and builds just in clang outside of Macports but when it is built via Macports, a number of macro redefined warnings are generated:

e.g.
./config.h:29:9: warning: 'HAVE_STDINT_H' macro redefined
#define HAVE_STDINT_H
        ^
./config.h:42:9: note: previous definition is here
#define HAVE_STDINT_H 1

I suspect Macports or the compiler is creating or referencing another config.h.

For this project, it looks like the simple solution is to add include guards to config.h.

In my view, It is not good practice to directly include in header files #include <config.h>  or #include "config.h" since this would lead to bad name conflicts etc.

The best solution appears to be outlined here:
https://stackoverflow.com/questions/28637542/ensure-config-h-is-included-once

But that would involve patching 30 or so source code files.

Has anyone else run into this issue regarding config.h using Macports and what solution did you employ?

Rob

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20220804/5c045917/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.h.orig
Type: application/octet-stream
Size: 1475 bytes
Desc: config.h.orig
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20220804/5c045917/attachment.obj>


More information about the macports-dev mailing list