ImportC and .h files
bachmeier
no at spam.net
Thu Jan 12 14:36:28 UTC 2023
On Thursday, 12 January 2023 at 06:30:15 UTC, Walter Bright wrote:
> On 1/11/2023 4:18 AM, bachmeier wrote:
>> A single function definition or enum imported in two places
>> within the same program prevents compilation.
>
> Thanks. I need reproducible test case, there's too much
> guesswork needed on my part in the bug report.
The [new bug referenced in this
thread](https://issues.dlang.org/show_bug.cgi?id=23622) indicates
that this is probably specific to including math.h. I added a
comment to the bug report, but here's the full test case:
foo.c
```
#include <math.h>
int main() {}
```
Compiles with gcc. DMD gives
```
#defines(797): Error: variable `foo.FP_NAN` conflicts with enum
member `__anonymous.FP_NAN` at /usr/include/math.h(855)
#defines(798): Error: variable `foo.FP_INFINITE` conflicts with
enum member `__anonymous.FP_INFINITE` at /usr/include/math.h(858)
#defines(799): Error: variable `foo.FP_ZERO` conflicts with enum
member `__anonymous.FP_ZERO` at /usr/include/math.h(861)
#defines(800): Error: variable `foo.FP_SUBNORMAL` conflicts with
enum member `__anonymous.FP_SUBNORMAL` at /usr/include/math.h(864)
#defines(801): Error: variable `foo.FP_NORMAL` conflicts with
enum member `__anonymous.FP_NORMAL` at /usr/include/math.h(867)
```
More information about the Digitalmars-d
mailing list