On Saturday, 27 July 2019 at 12:48:12 UTC, BoQsc wrote:

I seem to be doing something wrong, the result is the same.
otherFile.d(8): Error: only one main, WinMain, or DllMain allowed. Previously found main at mainFile.d(11)



private version = otherMain;
version(otherMain) {
        void main(){
                writeln("Interesting");
        }
}

Of course. When you import that module "version = ..." is likely still evaluated and it enables that second main. Either move it to yet another module(and that's just masks the problem) or use command-line parameter to toggle which one to use.

Reply via email to