Menu

{$define} Compiler Directive problem

KW Yan
2009-12-01
2013-04-25
  • KW Yan

    KW Yan - 2009-12-01

    Seems {$define} directive is introduced in 3.0 Alpha 2. But it doesn't work if I tested in 3.0 Alpha 3.

    {$ifdef xxx} still refers to Configuration name="xxx' in project file. Furthermore, the line number shown in complier error message is incorrect.

        program NewProject;
        {$define English}
        var
           Res : resource;
           S : string;
        begin
           Res := OpenResource('/xmap.txt');
        {$ifdef English}
           S := ReadLine (Res);
           x;
        {$else}
           S := 'abcd';
           x;
        {$endif}
           DrawText (S, 0,0);
           Repaint;
           Delay (2000);
        end.

    The configuration name in project file is default.  The compiler displayed:

    NewProject.mpsrc(12): E428 identifier 'x' is not ….

    In fact, x should be in line number 13. And there is no error message for y statement even though I use {$define English}

     
  • Javier Santo Domingo

    Fixed, it will be available in the next release.

    Btw, to check the preprocessor output is the new Preprocess tab in the code editor. Its very useful when you have tons of conditional defines in a single file and want to know what is going to be sent to the compiler.

    Thanks for the report!

     
  • KW Yan

    KW Yan - 2009-12-14

    Tested and the {$define} directive works in 3.0 Alpha 4.

     

Log in to post a comment.