On Sunday, 21 April 2024 at 08:44:38 UTC, alex wrote:
Hi guys. Trying to play with vibe-d and want to create separate web app, and cli app which can add admin users. When I just keep both files app.d and cli.d in source folder, I get an error that I can't have more then 1 main function.


You can do this using configurations. Whichever you list first will be the default. Then you can use `-c configName` or `--config=configName` to build the other one.

You'll want to exclude one of the main functions when building the configuration to which it doesn't belong. You can do that with version specifications (e.g., add a `cli` version in the cli configuration, then `vesrion(cli) void main {...}` in the code). Alternatively, if the files the main functions are in are self-contained, then you can just exclude the one you don't need in each configuration with the `excludeSourceFiles` directive.

Configurations:
https://dub.pm/dub-guide/recipe/#configurations

Reply via email to