Class not found : flixel.FlxGame



  • Good evening and nice to meet you,
    After following the instructions to install Haxe and to install Flixel,
    I decided to test the compiler by trying to build the hello world example.

    And I get this error in the terminal
    ./Main.hx:3: characters 7-21 : Class not found : flixel.FlxGame

    P.S. The command "haxelib upgrade" has already been executed.
    Why can't my Haxe compiler recognize Flixel libraries?
    Thanks



  • Can you write:
    haxelib list

    inside of the terminal and let me know what it says and also provide the code from Main.hx



  • Hello Zyrex, thanks for your care, I appreciate it.

    Haxelib list
    flixel-demos: [2.2.0]
    flixel-ui: [2.1.0]
    openfl: 3.6.1 [4.2.0]
    flixel-addons: [2.1.0]
    flixel: [4.1.1]
    flixel-tools: [1.2.1]
    lime: [3.2.1] 2.9.1
    flixel-templates: [2.1.0]

    The source file "Main.hx" is a default file created from a HaxeFlixel template.

    package;
    import flixel.FlxGame;
    import openfl.Lib;
    import openfl.display.Sprite;

    class Main extends Sprite
    {
    public function new()
    {
    super();
    addChild(new FlxGame(0, 0, MenuState));
    }
    }


  • administrators

    How are you trying to build the project? (command)



  • flixel tpl -n "HelloWorld"

    P.S. To compile the source files, I just open the directory in the terminal and type:
    haxe -swf Main.hx PlayState.hx AssetPaths.hx MenuState.hx



  • I think he meant

    lime test <target>
    

    <target> can be flash, neko or html5



  • The command "lime" is not recognized by the terminal, even though lime is in the list of the Haxelib libraries. See above
    If this error is unresolvable, I'll use another operating system.



  • Try

    haxelib run lime test <target>
    


  • Or you can run this first

    haxelib run lime setup
    

    Then you can do that:

    lime test <target>
    


  • haxelib run lime setup/test:

    Called from ? line 1
    Called from CommandLineTools.hx line 1430
    Called from CommandLineTools.hx line 25
    Called from a C function
    Called from CommandLineTools.hx line 64
    Called from CommandLineTools.hx line 1113
    Called from /usr/lib/haxe/std/neko/_std/sys/io/File.hx line 30
    Uncaught exception - [file_contents,/haxelib.json]



  • Why there's /test:

    haxelib run lime setup/test
    

    If this still happens, try the first one, I'm sure it will work without any problems



  • P.S. I tried both haxelib run lime setup & haxelib run lime test



  • First of all switch your version of OpenFl back to 3.6.1 and Lime to 2.9.1 since HaxeFlixel doesn't work with OpenFl 4 right now
    In case you don't know how:

    haxelib set openfl 3.6.1
    


  • I switched both OpenFL version and Lime version.
    There's nothing to do.
    I'll try using Windows 7.
    Thanks anyway for your support.



  • But what happened after you tried it again?



  • Nothing. The situation and the errors are the same as before.





  • I'm a bit confused as to why things aren't working, it shouldn't be this difficult. So lets start from from fresh and follow these steps:

    • Run the haxe uninstaller
    • Download haxe from the following link: http://haxe.org/download/
    • Run the installer
    • Go to command prompt and type in haxelib install flixel
    • When that's finished run haxelib run lime setup
    • I'm assuming you're running on windows so once that's finished run the following lime setup windows

    At this point everything should be setup, so lets make sure by compiling the demo project Flappybalt

    • First we need the demos go back to command prompt and run haxelib install flixel-demos
    • Navigate to the demo directory. Assuming you installed on the default path this is C:/HaxeToolkit/haxe/lib/flixel-demos/2,2,0/Arcade/Flappybalt
    • Open this directory in command prompt or navigate to it using the following cmd cd C:/HaxeToolkit/haxe/lib/flixel-demos/2,2,0/Arcade/Flappybalt
    • Run lime test windows

    Everything should work fine



  • [UPDATE]
    I switched O.S. (it's still ubuntu-based, though);

    Lime test commands works now. :thinking:
    But it's still impossible to compile using haxe -swf <sources.hx>
    Maybe it's not the way the compiler should be used? :confused:



  • @sabino Did you try starting from fresh?



  • What do you mean "fresh"? :confused:
    I followed the official instructions to install Haxe and Flixel, on another OS.

    Meanwhile, I can start programming using HaxeFlixel thanks to lime test neko.
    I appreciate it :slight_smile:
    And thanks to the friendly community.


Log in to reply