Haxe Forum > How can I know the Haxe version?

  • code like below:

    #if haxe_208
    trace("haxe 2.08");
    #else
    trace("not haxe 2.08");
    #end

    How can I check if the version is greater than 2.08?
    like this:
    #if version >= haxe_208
    trace("greater than or equal haxe 2.08");
    #else
    trace("less than haxe 2.08");
    #end;

    Thanks!

  • Let me start by saying, I could be wrong

    According to the manual - http://haxe.org/ref/conditionals

    #if haxe_210
        trace(" haxe version == 2.10");
    #else
        trace(" haxe version != 2.10");
    #end

    so

    #if haxe_208
        trace(" haxe version == 2.08");
    #else
        trace(" haxe version != 2.08");
    #end

    BUT - from something I read somewhere, and actually trying it, it's really

    #if haxe_208
        trace(" haxe version >= 2.08");
    #else
        trace(" haxe version < 2.08");
    #end
  • Actually, it is in away3dlite.core.utils
    Cast.hx
    #if haxe_206
    import flash.errors.Error;
    #else
    import flash.Error;
    #end

    and my haxe version is 2.08. Then it can't be compiled.

    ../away3d/trunk/haxe/Away3DLite/src/away3dlite/core/utils/Cast.hx:14: characters 0-19 : Class not found : flash.Error

  • The behaviour I described with

    #if haxe_208

    seems to have changed since 2.09

    From a quick look at haxe source code, in 2.08 and earlier

    #if haxe_xyy

    would only be true when the version is exactly x.yy

    Just upgrade to current haxe - then you'll have no such compatibility issues

< Prev | Page 1 / 1 | Next >