Zulip Chat Archive

Stream: new members

Topic: lake `main` entry point inside namespace


Bhakti Shah (Jul 26 2023 at 15:59):

I currently have a directory structure that's something like

├── Cedar
   ├── Difftest
      ├── Main.lean
├── lakefile.lean

(just the relevant bits). I'm trying to make Main.lean here my entry point for building an executable, and I have this:

@[default_target]
lean_exe CedarExe where
  root := `Cedar.Difftest.Main

This works fine when there's no namespaces involved.
However I would like my main function inside Main.lean to be within a namespace. As soon as I put it within a namespace though, I get this clang error:

ld64.lld: error: undefined symbol: _main
>>> referenced by the entry point
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Is there a way to configure the lakefile to accept main inside a namespace? Thanks!


Last updated: Dec 20 2023 at 11:08 UTC