Site icon TestingDocs.com

Build Mojo File

Overview

We can use the mojo build command to compile the Mojo file into an executable binary.
In this example, we will create an executable for the Hello World Mojo program
we created in the previous tutorial.

Build Mojo File

Use the mojo build command to build the Mojo file. The general syntax of the mojo build command is as follows:

$ mojo build <filename>

$ mojo build hello.mojo

This will create an executable file hello.

Run the executable

Type the following command to run the executable file.

$ ./hello

By default, the executable is created in the current directory and named the same as the input file without an extension. We can change the output filename and path
using the -o option of the build command.

More information at Modular official website:

https://www.modular.com/

Exit mobile version