BrettMayson / HEMTT

Build System for Arma 3
http://hemtt.dev/
GNU General Public License v2.0
115 stars 40 forks source link

Working with macroses in cpp #496

Closed diraven closed 1 year ago

diraven commented 1 year ago

Having macroses in cpp files causes errors like:

 19 |         function = QFUNC(someFunctionName);
    |                    ^ expected one of: [LeftBrace, DoubleQuote, Digit(0)]
help: Did you forget to place quotes around a string? Or perhaps you forgot to define / import a value.

Is there a way around it?

PS: Just wanted to say "Thanks". It does everything I automated with Python and more. Very convenient and immensely useful.

BrettMayson commented 1 year ago

Is that macro defined? Are you including the file that defines it?

diraven commented 1 year ago

Here is the one I have issues with:

class Extended_PreInit_EventHandlers
{
    class ADDON
    {
        // This will be executed once in 3DEN, main menu and before briefing has started for every mission
        init = QUOTE(call COMPILE_FILE(XEH_preInit));
    };
};

It's a part of extended event handlers init CfgEventHandlers.hpp.

The error is

    |
  6 |           init = QUOTE(call COMPILE_FILE(XEH_preInit));
    |          ^ expected one of: [LeftBrace, DoubleQuote, Digit(0)]
help: Did you forget to place quotes around a string? Or perhaps you forgot to define / import a value.
proudCobolWriter commented 1 year ago

Hey! I'm having the exact same error with macroses, have you found a workaround since?

diraven commented 1 year ago

Hey! I'm having the exact same error with macroses, have you found a workaround since?

Nope. That's the only place I never figured out though. So I'm just using raw code there without macroses. Good thing is it only fails in ExtEventHandlers though. I didn't encounter it anywhere else. In other places it was my own fault by providing unquoted values. E.g. FUNC() or GVAR() instead of QFUNC() and QGVAR().

BrettMayson commented 1 year ago

Can you provide a link to a copy of the project that is getting that error

diraven commented 1 year ago

Interestingly enough, it works for me now. Not sure what changed since I did not update hemtt executable.