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}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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}
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!
Tested and the {$define} directive works in 3.0 Alpha 4.