There are missing information here, I suppose you are working on a form.

If you remove the unit for fastreport and you still have references to it
on the form the delphi IDE will automatically add the uses back again.

the correct manner in this case is that:

- having separated forms, one for windows and another for mobile. Where you
add the propert unit using {$IFDEF} for each case
- not using fastreport as a control on the form. In this case you create
everything on the fly, manually, and then you can surround this code with
{$IFDEF} to no be executed when compiled to mobile

you should not use ifdefs with forms declarations, one part of the declaration
is in the class, but there is form stream, and that is out of reach for IFDEF.

Delphi XE 7.

I have adding a fastreport 2.o FMX report onto my form

When I switch to mobile I get errors.

I can fix the design time uses errors by by

($IF DEFINED (MSWINDOWS) }

uses FMX.frxClass

{$ENDIF}

but when I run the app on mobile it adds FMX.frxClass to the uses and
fails

Also I can work out the syntax to do the same with the type eg

frxReport1: TfrxReport

What is the correct method for components that are not available on
mobile.

for example, if you are creating a project for Android, you cannot have
units that are not supported on that platform.

There is no FastReport yet for Android or iOS.

So when you compile for that platform you cannot have the unit declared.

For that you need to use the $IFDEF, only allowing it on the platforms that
you want.

What I told you is not to use one unit full of IFDEFS, instead, create a
unit for mobile and another for the rest.

Then you include the mobile unit when you targeting mobile..... otherwise
use the other unit....

Only you will use FastReport on the unit that is not for mobile.

based on what you said on your first post, you are including units that are
not compatible, not supported on mobile. You need to pay attention to that.
You can create the application for windows, but just trying to compile to
another platform will not work. If you need to have reports on all the platforms
you need to use something else, like FlexCel from TMS, since FastReports
do not suppor all platforms.

Hi Eduatdos,

I am not understanding the concept here.

I was presuming I could build a firemonkey app with some reports but
'switch off' them when running on mobile.

When I add another form to the project and then add a report component
I still get the error

If so, this is the problem. Even that you create this DEFINES, you have a
component in the form that should not be there when compiling to mobile.

When you open your form, delphi IDE will try to help you and will add the
units in order to make that component compile correctly.

You have 2 options:

1 - do not use the component in the form

you will need to create in manually. Declare it on your form class and create
it on FormCreate. But only do that if you are not targeting mobile.

2 - better: create 2 different units. One for mobile and other for desktop.
Then you are not going to have a lot of DEFINES in you source. In this case
you need to add the DEFINE in your project file or in the MainForm:

this way, when you compile the application the correct version of your form
will be compiled. If it is windows for example, it will use the "formdesktop"
where you have FastReports. The other version will not have it at all.

Does it get clearer to you?

Hi Eduardo,

I am still not understanding the methods to use.
I have tried:
Add another form (reports).
Do not add this form to the uses of the main form.
I then add a report component onto the report form.
When I switch to mobile I get an error.
So I tried :

Another thing, the "reportsmobile" should not have any component from fastreports.
Did you make a copy and past of the unit and form in order to create these
units? probably you left the components on the form.

Like I said, Delphi IDE will add always the units that are missing when you
have a component on the form and there is a missing unit. You need to check
what components you have in your MOBILE form. And remove all those that are
related to FastReports. I believe there is the FastReport Dataset in there.