One project file for a windows PC and a MAC

Hi,

I have been developing a project with Xojo on Windows for years. Now I would like to continue to develop that project on a MAC.

I understand from Xojo documentation that I can compile on my Windows PC a binary for MAC. But what I want to do is get my Xojo project (developed on Windows) to compile with Xojo IDE running on MAC; I have tried but compilation fails.

Is there a way/guideline to follow in order to have a Windows Xojo project copied on a MAC and which I can continue to develop on such MAC?

Many thanks!

Pierre

It should just be a need to turn on an option for Mac compilation. However, if you have used any API calls that are specific to Windows then obviously that will not work on Mac. To solve this sort of problem the language has built in branching options. For example you can place any Windows specific code inside a target bloc:

#if TargetWindows
   // windows specific code here
#end if

Equally, if you need something Mac specific you can use:

#if TargetMacOS
   // Mac specific code here
#end if

You can obviously combine such things into the following:

#if TargetWindows
   // windows specific code here
#elseif TargetMacOS
   // Mac specific code here
#end if

Please, explain what you meant by “fails”…

NB: this works fine here.

1 Like

Thanks Ian I will try to remove any windows specific code and see how it goes.

Emile, the error message pops up when I am on my project open on Xojo IDE on my MAC, I try to launch the app by clicking the arrow to build it and test. The message says:
“Compilation of [project name] failed. an error occurred when attempting to launch the application”

Thx

Pierre

You don’t remove the code just protect it in “#if Target” blocks. The idea is to have one project for both platforms.

ok got it, thx!

Check the macOS name of the application of if one application with that name already exists near the project.

What Xojo version are-you using (Windows and Mac) ?

I changed the build settings parameters; it was still set to x86, I changed it to ARM64 and now it works (I have a Mini M1).

Thanks again!

Pierre

This was nearly impossible to guess… :wink:

You can see it to Universal and then Mac app will be built to run on either Apple Silicon machines and Intel ones.