简体   繁体   English

编译没有Main类的Haxe库

[英]Compiling a Haxe library without a Main class

I'm writing a library in Haxe that does not expose a "Main" class. 我正在Haxe写一个不暴露“Main”类的库。 Instead it simply contains typedefs & classes, which are intended for use in other applications which are compiled including this library. 相反,它只包含typedef和类,它们用于包含此库的其他应用程序。

If I try to compile without a -main option, I get the following error: 如果我尝试编译没有-main选项,我会收到以下错误:

Haxe Compiler 3.2.1 - (C)2005-2015 Haxe Foundation
 Usage : haxe -main <class> [-swf|-js|-neko|-php|-cpp|-as3] <output> [options]

Does the Haxe compiler prevent you from compiling a library that doesn't have an entry point? Haxe编译器是否阻止您编译没有入口点的库?


You can compile without a main using something like the following build.hxml: 你可以在没有main的情况下使用类似下面的build.hxml进行编译:

-cp src 

# add the package(s) that you want to include the following way: 
--macro "include('package1.foo')"
--macro "include('package2.bar.test.buz')"
...

-js bin/index.js

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM