This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GCC compiling issue with python.h (multiple definitions of __BSD_VISIBLE)


Hi, Cygwin team

With latest cygwin (python 3.4 and gcc 5.4.0), I got compiling issue with duplicated definition of macro __BSD_VISIBLE. Following is a simple example to expose the issue:

#include <string>
#include <Python.h>
#include <vector>
#include <map>
//#include <string>
#include <iostream>

int main(int argc, char ** argv)
{
    return 0;
}

After compiling with " g++ -g -O2 -std=c++11 test.c -o test `python3-config --includes`", I got following error:

In file included from /usr/include/python3.4m/Python.h:8:0,
                 from test.c:2:
/usr/include/python3.4m/pyconfig.h:1440:0: warning: "__BSD_VISIBLE" redefined
 #define __BSD_VISIBLE 1
 ^
In file included from /usr/include/sys/config.h:5:0,
                 from /usr/include/_ansi.h:16,
                 from /usr/include/wchar.h:4,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/cwchar:44,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/bits/postypes.h:40,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/bits/char_traits.h:40,
                 from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/string:40,
                 from test.c:1:
/usr/include/sys/features.h:250:0: note: this is the location of the previous definition
 #define __BSD_VISIBLE  0
 ^
In file included from /usr/include/python3.4m/pyport.h:335:0,
                 from /usr/include/python3.4m/Python.h:50,
                 from test.c:2:
/usr/include/sys/time.h:104:34: error: 'u_int' has not been declared bintime_mul(struct bintime *_bt, u_int _x)

One tricky thing is that if I include <string> after "Python.h". Compiling goes through. I don't see this issue on linux/Mac OS.

I don't see this is a valid solution. Since with more complicated code, I run into a segment default at very beginning of the program.

Thanks

Yan

Attachment: cygcheck.out
Description: Binary data

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]