# E4067

Missing main function in the main package.

In MoonBit, packages are divided into two types: main packages and non-main
packages. Non-main packages are often used as libraries to provide functionality
to other packages. Main packages, on the other hand, are the entry points of the
program. Therefore, a main package should contain a `main` function serving as
the entry point of the program.

## Erroneous example

Suppose in package `main`:

`main/moon.pkg`:

```{literalinclude} /sources/error_codes/4067_error/moon.pkg
:language: moonbit
```

`main/main.mbt`:

```{literalinclude} /sources/error_codes/4067_error/top.mbt
:language: moonbit
```

## Suggestion

You can add a `main` function to the main package:

`main/main.mbt`:

```{literalinclude} /sources/error_codes/4067_fixed/top.mbt
:language: moonbit
```

Alternatively, you can set the package to be a non-main package by setting
`"is-main"` to `false` in the package configuration file.

`main/moon.pkg`:

```moonbit
options(
  "is-main": false,
)
```
