<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
I am working on creating a new port that uses its own <b>config.h</b>. 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:</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
e.g. </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<blockquote style="margin-top:0;margin-bottom:0">.<b>/config.h:29:9: warning: 'HAVE_STDINT_H' macro redefined</b>
<div><b>#define HAVE_STDINT_H</b></div>
<div><b> ^</b></div>
<div><b>./config.h:42:9: note: previous definition is here</b></div>
<b>#define HAVE_STDINT_H 1</b><br>
</blockquote>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
I suspect Macports or the compiler is creating or referencing another <b>config.h</b>.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span style="color: rgb(35, 38, 41); font-family: Calibri, Helvetica, sans-serif; font-size: 15px; text-align: left; background-color: rgb(255, 255, 255); display: inline !important;">For this project, it looks like the simple solution is to add </span><span style="font-family: Calibri, Helvetica, sans-serif;"><b style="color: rgb(35, 38, 41); font-size: 15px; text-align: left;">include
guards</b></span><span style="color:rgb(35, 38, 41);font-family:-apple-system, "system-ui", "Segoe UI Adjusted", "Segoe UI", "Liberation Sans", sans-serif;font-size:15px;text-align:left;background-color:rgb(255, 255, 255);display:inline !important"><span style="font-family: Calibri, Helvetica, sans-serif;"> </span></span><span style="color: rgb(35, 38, 41); font-family: Calibri, Helvetica, sans-serif; font-size: 15px; text-align: left; background-color: rgb(255, 255, 255); display: inline !important;">to <b>config.h.</b></span><br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
In my view, It is not good practice to directly include in <em style="margin:0px;font-family:-apple-system, "system-ui", "Segoe UI Adjusted", "Segoe UI", "Liberation Sans", sans-serif;font-size:15px;color:rgb(35, 38, 41);text-align:left;background-color:rgb(255, 255, 255)">header</em><span style="color:rgb(35, 38, 41);font-family:-apple-system, "system-ui", "Segoe UI Adjusted", "Segoe UI", "Liberation Sans", sans-serif;font-size:15px;text-align:left;background-color:rgb(255, 255, 255);display:inline !important"><span> </span>files
<span>#</span></span><b><code style="margin:0px;padding:var(--su2) var(--su4);font-family:var(--ff-mono);font-size:var(--fs-body1);background-color:var(--black-075);color:rgb(35, 38, 41);border-radius:var(--br-sm);text-align:left">include</code><span style="color:rgb(35, 38, 41);font-family:-apple-system, "system-ui", "Segoe UI Adjusted", "Segoe UI", "Liberation Sans", sans-serif;font-size:15px;text-align:left;background-color:rgb(255, 255, 255);display:inline !important"><span> <</span></span><code style="margin:0px;padding:var(--su2) var(--su4);font-family:var(--ff-mono);font-size:var(--fs-body1);background-color:var(--black-075);color:rgb(35, 38, 41);border-radius:var(--br-sm);text-align:left">config.h></code></b><span style="color:rgb(35, 38, 41);font-family:-apple-system, "system-ui", "Segoe UI Adjusted", "Segoe UI", "Liberation Sans", sans-serif;font-size:15px;text-align:left;background-color:rgb(255, 255, 255);display:inline !important">
or <b>#include "config.h"</b> since this would lead to bad name conflicts etc.</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span style="color: rgb(35, 38, 41); font-family: -apple-system, "system-ui", "Segoe UI Adjusted", "Segoe UI", "Liberation Sans", sans-serif; font-size: 15px;"><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span style="color: rgb(35, 38, 41); font-family: -apple-system, "system-ui", "Segoe UI Adjusted", "Segoe UI", "Liberation Sans", sans-serif; font-size: 15px;">The best solution appears to be outlined here:</span><br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span style="color:rgb(35, 38, 41);font-family:-apple-system, "system-ui", "Segoe UI Adjusted", "Segoe UI", "Liberation Sans", sans-serif;font-size:15px;text-align:left;background-color:rgb(255, 255, 255);display:inline !important"><a href="https://stackoverflow.com/questions/28637542/ensure-config-h-is-included-once" id="LPNoLPOWALinkPreview">https://stackoverflow.com/questions/28637542/ensure-config-h-is-included-once</a><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
But that would involve patching 30 or so source code files.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Has anyone else run into this issue regarding <b>config.h</b> using Macports and what solution did you employ?</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Rob</div>
<div class="_Entity _EType_OWALinkPreview _EId_OWALinkPreview _EReadonly_1"></div>
<br>
</body>
</html>