如何使用Eclipse编译Haxe程序?

如何使用Eclipse编译Haxe程序?,eclipse,eclipse-plugin,haxe,Eclipse,Eclipse Plugin,Haxe,我安装了Eclihx插件,现在正在尝试测试它。Main.hx的内容是 class Main { static function main() { trace("This is a test."); } } Build.hxml的内容是 -cp Source # Uncomment the desirable target # JavaScript target -js Output/haxe Test.js # SWF 9 target -swf9 Outp

我安装了Eclihx插件,现在正在尝试测试它。Main.hx的内容是

class Main {
    static function main() {
        trace("This is a test.");
    }
}
Build.hxml的内容是

-cp Source

# Uncomment the desirable target
# JavaScript target
-js Output/haxe Test.js

# SWF 9 target
-swf9 Output/haxe Test.swf

# ActionScript3 target
-as3 Output

# Neko target
-neko Output/haxe Test.n

# PHP target
-php Output

# C++ target
-cpp Output

# Uncomment and place your main class with package
-main Main

“项目”菜单中的“生成”选项将灰显。我该怎么办?

首先,您不能一次编译所有目标,您需要注释所有目标并取消注释,例如javascript目标

然后,打开Haxe包资源管理器并选择鼠标左键单击项目根目录,然后鼠标右键单击、运行方式、运行配置

左键双击Haxe应用程序,您将获得新的\u配置。选择项目,设置生成文件,然后单击运行。您的项目已编译。此外,还可以使用CTRL+11来编译项目

现在,您需要测试javascript目标的html文档。在生成.js文件的输出目录中创建test.html,并使用如下内容:

<html>
<head><title>Haxe JS</title></head>
<body>
<div id="haxe:trace"></div>
<script type="text/javascript" src="hxTest.js"></script>
</body>
</html>
对于Neko,我通常将.n扩展与Neko程序相关联,等等。然后,您只需双击.n即可执行您的程序

提示:项目属性、Haxe内容辅助、生成文件从项目中选择Build.hxml以启用代码完整性。

我强烈建议使用