netmail-open / wjelement

advanced, flexible JSON manipulation in C
GNU Lesser General Public License v3.0
108 stars 56 forks source link

Conflicting declaration in xpl.h on type 'int32' on AIX #109

Closed reister-kenneth closed 1 year ago

reister-kenneth commented 1 year ago

Our code

#include <iterator>
#include <list>
#include <vector>
#include "element.h"

On AIX

-bash-4.4# cat /usr/include/sys/inttypes.h | grep "int32;"
typedef signed int              int32;
typedef unsigned int            u_int32;

Compile output

wjelement-1.2/include/xpl.h:140:21: error: conflicting declaration 'typedef long int int32'
 typedef signed long int32;
                     ^
/usr/include/sys/inttypes.h:620:21: error: 'int32' has a previous declaration as 'typedef int int32'
 typedef signed int  int32;

<iterator> had a whole chain that leads to inttypes.h. inttypes.h does #include <stdint.h> which defines this:

-bash-4.4# cat /usr/include/sys/stdint.h | grep INT32_MAX
#define INT32_MAX       (2147483647)

I will note that I've solved this one already for us as we were not using <iterator>, <list>, or <vector> in that file, so I just removed them.

penduin commented 1 year ago

AIX! Very interesting; we'd love to know what WJE has found its way into there. :^)

As for the conflict itself, I suppose we could surround with an #ifndef or something. I don't foresee any problem with allowing and using an external definition, unless the distinction between signed long and signed int is meaningful to your data.

reister-kenneth commented 1 year ago

Two updates.