Including exprtk requires compiler setting /GR

ExprTk is a lexer, parser and evaluator for equations. I’ve included it in my project and get two compiler errors.

First one is regarding the macro verify (used in UE4 and exprtk), which I could fix by renaming this macro in exprtk.

The second one is the problem: C4541 in ue_4.15\engine\source\runtime\coreuobject\public\Templates\Casts.h, line 405:

  • ‘dynamic_cast’ used on polymorphic
    type ‘exprtk::lexer::token_scanner’
    with /GR-; unpredictable behavior may
    result
  • ‘dynamic_cast’ used on polymorphic
    type ‘exprtk::details::expression_node’
    with /GR-; unpredictable behavior may
    result

Is it a problem activating /GR for Unreal Engine?
If no, how can I activate it within an Unreal project?

Or even better, can I avoid that Casts.h is used with exprtk?

Did you ever find the solution to this problem? My team is having the same issue…

Unfortunately not. I skipped using exprtk with UE4 atm. In my case I had only a dozen equations so it was ok to hardcode each formula into an own class and doing some string manipulation for certain conditions myself. It is ugly but still ok if you only have a handful of possible equations and conditions.