【问题标题】:Can't use neko classes in a simple haxe program不能在简单的 haxe 程序中使用 neko 类
【发布时间】:2013-01-13 04:35:06
【问题描述】:

haxe代码很简单:

Main.hx

package nekotest;

class Main {

    public static function main() {
        var name = neko.System.args()[0];
        trace("Hello " + name);
        trace("Your name is " + Std.string(name.length) + " characters longs.");
    }

}

在控制台中:

E:\WORKSPACE\HaxeTest\src>haxe -main nekotest.Main -neko test.n
nekotest/Main.hx:6: characters 19-35 : Unknown identifier : neko

haxe 和 neko 都安装好了:

E:\WORKSPACE\HaxeTest\src>haxe
Haxe Compiler 2.10 - (c)2005-2012 Motion-Twin
 Usage : haxe.exe -main <class> [-swf|-js|-neko|-php|-cpp|-cs|-java|-as3] <output> [options]
 Options :
  -cp <path> : add a directory to find source files
  -js <file> : compile code to JavaScript file
  -swf <file> : compile code to Flash SWF file

E:\WORKSPACE\HaxeTest\src>neko
NekoVM 1.8.2 (c)2005-2011 Motion-Twin
  Usage : neko <file>

我错过了什么吗?

【问题讨论】:

    标签: haxe neko


    【解决方案1】:

    我使用的文件已过时,“neko.System”已被删除。我用的是新代码,可以编译:

    static function main() {
        Sys.println("What's your name?");
        var input = Sys.stdin().readLine();
        Sys.println("Hello " + input);
    }
    

    【讨论】:

      【解决方案2】:

      修改后生效

      var name = neko.System.args()[0];
      

      var name = System.args()[0];
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多