Skip to content

Multiple definitions #1693

Closed
Closed
@TomzBench

Description

@TomzBench

I have a really rough looking header (it's amalgamation).

https://github.com/TomzBench/mongoose-rs/blob/master/mongoose-sys/wrapper.h

Mongoose is a pretty popular single threaded web server for embedded systems written in C. So I went to try and make a binding to it and when I compile it I get a few errors such as seen below. (My repository is pretty minimal to reproduce.)

1007 | pub const IPPORT_RESERVED: u32 = 1024;
     | -------------------------------------- previous definition of the value `IPPORT_RESERVED` here
...
3092 | pub const IPPORT_RESERVED: _bindgen_ty_6 = 1024;
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `IPPORT_RESERVED` redefined here
975  | pub const FP_NAN: u32 = 0;
     | -------------------------- previous definition of the value `FP_NAN` here
...
5166 | pub const FP_NAN: _bindgen_ty_8 = 0;
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `FP_NAN` redefined here

The culprit is defined first as:

pub const FP_NAN: u32 = 0;
pub const FP_INFINTE: u32 = 1;
pub const FP_ZERO: u32 = 2;
pub const FP_NORMAL: u32 = 3;

Then it is redefined again some 5000 lines later as

pub const FP_NAN: __bindgen_ty_8 = 0;
pub const FP_INFINTE: __bindgen_ty_8 = 1;
pub const FP_ZERO: __bindgen_ty_8 = 2;
pub const FP_NORMAL: __bindgen_ty_8 = 3;

It looks like __bindgen_ty_8 is a u32 so they are defined as equal - but still produces error.
(also If I copy out the binding.rs and delete the duplicate's then it does compile ok...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions