haXe Forum > Class path?

  • Hi List,

    I am stuck with a newbie problem. So I have the files

    1. Gaga.hx with code

    class Gaga {
    static function main() {
    var g = new RadioGaga();
    g.gaga();
    }
    }

    2. G.hx with code

    class RadioGaga {
    public function gaga () {
    trace ("All we hear");
    }

    public function new () {}
    }

    These files are in the same directory. The HaXe compiler doesn't find the class RadioGaga:

    [75] ~/Software/Flash/Haxe/FirstHacks/Gaga haxe -main Gaga -swf9 gaga.swf -cp ./
    ./Gaga.hx:3: characters 10-25 : Class not found : RadioGaga

    I also tried a package declaration, with similar results...

    Any comment welcome :-)

    Kris

  • Change G.hx to RadioGaga.hx .

  • Hi,

    It needs you to assign an environment variable called `HAXE_LIBRARY_PATH`. For instance, provided you are using bash as login shell on Linux-like system, issue the command `export HAXE_LIBRARY_PATH=$HAXE_LIBRARY_PATH:.`

    Hope it helps,
    ;)

  • Often reading in the documentation helps: Packages and Imports
    Classnames must be the same as the filenames. Folder structure must be the same as the package structure.

  • try to import G instead of RadioGaga, the import thingy is refer to the filename *IMHO

  • Many thanks to all :-) Haxe's module system can be confusing at boot time...

< Prev | Page 1 / 1 | Next >