sustrik/libmill

Compilation error with #define MILL_USE_PREFIX

Nightaway opened this issue · 6 comments

/usr/local/include/libmill.h:402:27: error: conflicting declaration ‘typedef struct mill_chan* mill_chan’
typedef struct mill_chan mill_chan;
^
/usr/local/include/libmill.h:257:8: note: previous declaration as ‘struct mill_chan’
struct mill_chan;
^
/usr/local/include/libmill.h:523:30: error: conflicting declaration ‘typedef struct mill_tcpsock
mill_tcpsock’
typedef struct mill_tcpsock mill_tcpsock;
^
/usr/local/include/libmill.h:482:8: note: previous declaration as ‘struct mill_tcpsock’
struct mill_tcpsock;
^
/usr/local/include/libmill.h:575:30: error: conflicting declaration ‘typedef struct mill_udpsock
mill_udpsock’
typedef struct mill_udpsock mill_udpsock;
^
/usr/local/include/libmill.h:554:8: note: previous declaration as ‘struct mill_udpsock’
struct mill_udpsock;
^
/usr/local/include/libmill.h:633:31: error: conflicting declaration ‘typedef struct mill_unixsock
mill_unixsock’
typedef struct mill_unixsock mill_unixsock;
^
/usr/local/include/libmill.h:594:8: note: previous declaration as ‘struct mill_unixsock’
struct mill_unixsock;
^
/usr/local/include/libmill.h:703:30: error: conflicting declaration ‘typedef struct mill_sslsock
mill_sslsock’
typedef struct mill_sslsock *mill_sslsock;
^
/usr/local/include/libmill.h:662:8: note: previous declaration as ‘struct mill_sslsock’
struct mill_sslsock;

Interesting. What compiler is that? What settings are you using to compile?

That looks like something a C++ compiler would produce? I think libmill.h is a C-only header.

EDIT: Scratch that, it appears that libmill supports C++ as well? Maybe something compiler-specific then.

It's produced by gcc version 4.9.4 (Ubuntu 4.9.4-2ubuntu1~14.04.1) COLLECT_GCC=g++.

test1.cc:

#define MILL_USE_PREFIX
#include <libmill.h>

int main() {
    return 0;
}

g++ -c test1.cc

Okay, seems that it's compatible with gcc and g++ without MILL_USE_PREFIX, and only compatible with gcc if MILL_USE_PREFIX is defined.

Fixed in head.