NanoMichael / MicroTeX

A dynamic, cross-platform, and embeddable LaTeX rendering library
MIT License
440 stars 74 forks source link

Conflict with some macros #44

Open Xrysnow opened 3 years ago

Xrysnow commented 3 years ago

My environment has macro UNICODE and DEBUG defiened and they conflict with some names in the project. I think it's better to rename them to avoid this.

NanoMichael commented 3 years ago

Is there just DEBUG macro is conflict? If you can provide more macros that conflict I can rename them in one PR.

Xrysnow commented 3 years ago

UNICODE is also defined on windows when using unicode charset.

Anyway, all-upper names without prefix or postfix are easy to meet conflict. I think you can change their name style

PikachuHy commented 3 years ago

DEBUG is a macro in MSVC. Please rename it. To compile the code in MSVC, I hack it. see https://github.com/NanoMichael/cLaTeXMath/commit/a734d9cf2b205ebd391f5ebf06551d768a983804

PikachuHy commented 3 years ago

UNICODE is also a macro in MSVC.

hsandt commented 3 years ago

Coming from https://github.com/Xrysnow/LuaSTG-x (@Xrysnow 's project which uses cLaTeXMath) and also encountered build issue because of DEBUG:

1>...LuaSTG-x_release_20210528\frameworks\external\cLaTeXMath\src\src\core\formula.cpp(194,14): error C2589: '=': illegal token on right side of '::' 1>...LuaSTG-x_release_20210528\frameworks\external\cLaTeXMath\src\src\core\formula.cpp(194,17): error C2082: redefinition of formal parameter 'b'

I renamed Box::DEBUG to Box::enableDebug in atom.h, box.cpp and formula.cpp to make it work.

(btw it would probably be easier to maintain if the Box was entirely defined in its own file rather than split across files, unless there's a reason for keeping the declaration in atom.h)

@Xrysnow how did you actually build your project? Did you find a workaround that doesn't require changing source files?