gjtorikian / mtex2MML

A Bison grammar to convert TeX math into MathML.
23 stars 14 forks source link

MSVC build error,maybe conflict with math.h #67

Open EruditePig opened 4 years ago

EruditePig commented 4 years ago

First, Thank you for your effort, It is a great repo~ :)

I compile in windows 10 + Chocolate winbisonflex3 + Cmake. Build sln is OK, but compile has error

C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\math.h(963): error C2059: synax error constant

I thought the reason is "HUGE"is a token defined in parser.c and parser.h. However, in math.h it has code below which define HUGE a variable.

#if !__STDC__

    // Non-ANSI names for compatibility
    #define DOMAIN      _DOMAIN
    #define SING        _SING
    #define OVERFLOW    _OVERFLOW
    #define UNDERFLOW   _UNDERFLOW
    #define TLOSS       _TLOSS
    #define PLOSS       _PLOSS

    #define matherr     _matherr

    #ifndef __assembler
        #ifndef _M_CEE_PURE
            extern double HUGE;
        #else
            double const HUGE = _HUGE;
        #endif

        _CRT_NONSTDC_DEPRECATE(_j0) _Check_return_ _ACRTIMP double __cdecl j0(_In_ double _X);
        _CRT_NONSTDC_DEPRECATE(_j1) _Check_return_ _ACRTIMP double __cdecl j1(_In_ double _X);
        _CRT_NONSTDC_DEPRECATE(_jn) _Check_return_ _ACRTIMP double __cdecl jn(_In_ int _X, _In_ double _Y);
        _CRT_NONSTDC_DEPRECATE(_y0) _Check_return_ _ACRTIMP double __cdecl y0(_In_ double _X);
        _CRT_NONSTDC_DEPRECATE(_y1) _Check_return_ _ACRTIMP double __cdecl y1(_In_ double _X);
        _CRT_NONSTDC_DEPRECATE(_yn) _Check_return_ _ACRTIMP double __cdecl yn(_In_ int _X, _In_ double _Y);
    #endif // !__assembler
#endif // !__STDC__

I fix this problem by adding #define STDC 1 in the top of lexer.c file. I don't know whether it is correct way to fix it. So I post a issue to you, Hope can do a little help.

Thank you Again!