我刚开始学习Haxe,但遇到了编译错误。未找到类:helloworld.Main
Main.hx
package helloworld;
import js.Lib;
class Main {
static function main() {
Lib.alert("Hello World");
}
}
请小心目标类是helloworld.Main
。
build.hxml
-js bin/HelloWorld.js
-cp src
-main helloworld.Main
-debug
构建过程日志
Building HelloWorld_p140627
Running Pre-Build Command Line...
cmd: C:\HaxeToolkit\haxe\haxe.exe X:\tmp\HelloWorld_p140627\build.hxml
Class not found : helloworld.Main
Build halted with errors.
Done(1)
为什么?类helloworld.Main
肯定存在。我甚至不能说“你好,世界”?现在
我确认了项目的文件格式,但没有什么好奇的。我已经添加了上面的布局。你能找到编译错误的原因吗? – weed
更新我的答案。你错过的是你要求“helloworld.Main”,即“src/helloworld/Main.hx”,而这个不存在。 –
非常感谢Jason,我明白了。我成功编译。 – weed