20tab / UnrealEnginePython

Embed Python in Unreal Engine 4
MIT License
2.74k stars 743 forks source link

'_POSIX_C_SOURCE' macro redefined..., '_XOPEN_SOURCE' macro redefined #521

Open shdwdln opened 6 years ago

shdwdln commented 6 years ago

Hi, I am compiling from source of Centos7.5 and everything was compiling fun until I hit these errors:

`/usr/include/python2.7/pyconfig-64.h:1191:9: error: '_POSIX_C_SOURCE' macro redefined [-Werror,-Wmacro-redefined]

define _POSIX_C_SOURCE 200112L`

previously defined as: # define _POSIX_C_SOURCE 200809L

OS defined: #define _POSIX_C_SOURCE 200112L

UnrealEngine defined: # define _POSIX_C_SOURCE 200809L


What is the solution to this? Should I comment out these two lines in the UnrealSource code?

I am running:

Python 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux2

Thanks people! This is the most exciting project!

shdwdln commented 6 years ago

on line 167-168 it says:

# undef  _POSIX_C_SOURCE
# define _POSIX_C_SOURCE    200809L

so it should be undefining the OS version then right?

rdeioris commented 6 years ago

Yes, adding #undef before including Python.h in UnrealEnginePython.h should do the trick. Not the most elegant stuff but i see no other solutions

shdwdln commented 6 years ago

It won't obey it is the thing... It hits that area but it won't undef it. Then when it tries to redefine it immediately after, it says it was already defined...

What to do?

rdeioris commented 6 years ago

Sorry, i do not have access to a centos system, but very probably you will need to re-undef _POSIX_C_SOURCE after Python.h to allow UE to re-define (sorry for the bad wording ;). Basically, UE4 must not find python _POSIX_C_SOURCE definition.