ofxPython icon indicating copy to clipboard operation
ofxPython copied to clipboard

OSX 10.12 compile conflict when including regex

Open Daandelange opened this issue 5 years ago • 0 comments

Hello, I stumbled upon an issue on osx 10.12.0 when compiling a program using ofxPython, python 2.7 and libC++'s regex. (Osx 10.13 and 10.14 don't seem to be concerned.)
I'm using XCode 8.1.

To reproduce :

#include "ofxPython.h" // --> loads /usr/include/python2.7/pyport.h
//#undef tolower // <-- uncomment to "fix" compilation issue
#include <regex> // --> /usr/include/c++/v1/regex

This leads to a macro-definition conflict. ofxPython defines tolower, which is also used by libc++'s std::regex : /usr/include/c++/v1/regex:1216: error: too many arguments provided to function-like macro invocation : __ct_->tolower(&__s[0], &__s[0] + __s.size());

A temporary (and dirty) workaround is to reset the tolower macros before the regex include. I have no idea how this affects the inner workings of python.

This issue is rather related to pyport.h from the Python project. Reporting this issue to share my findings. Feel free to close anytime.

Daandelange avatar Feb 26 '20 16:02 Daandelange