Question

The haxe code is very simple:

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.");
    }

}

In console:

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

The haxe and neko are all installed:

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>

Do I miss something?

Was it helpful?

Solution

The document I used is outdated, the "neko.System" has been removed. I use the new code, which can be compiled:

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

OTHER TIPS

It works after changing

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

to

var name = System.args()[0];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top