0

When running this command

haxe -main Main.hx

I'm getting this error

Main.hx:2: characters 7-33 : Type not found : createjs.easeljs.Container

Main.hx

package ;
import createjs.easeljs.Container;
import createjs.easeljs.Shape;
import createjs.easeljs.Stage;
import createjs.easeljs.Text;
import createjs.easeljs.Ticker;
import js.Browser;
import js.html.CanvasElement;
import js.html.Element;

I've included the javascript file for the createjs library and I also installed the library using the command

haxe install createjs
Vincent Le
  • 136
  • 2
  • 11

1 Answers1

0

You have to include the createjs haxelib with the -lib argument during compilation:

haxe -main Main.hx -lib createjs

Gama11
  • 31,714
  • 9
  • 78
  • 100
  • I'm getting this error now but its pointing to code in the createjs library `/Users/Vincent/Repos/skytroops/bin/js/createjs/1,5,8/createjs/easeljs/ColorMatrix.hx:13: characters 8-50 : Invalid number of type parameters for Array` – Vincent Le Nov 22 '15 at 19:36
  • That's a different isuse, and one I can't reproduce. What does your code look like, and what's your Haxe version (`haxe -version`)? – Gama11 Nov 22 '15 at 20:03
  • My haxe version is 3.2.1 – Vincent Le Nov 22 '15 at 20:11
  • Managed to reproduce it - this is an issue with the extern definition. Changing `Array` to `Array` in line 13 and 14 in that file fixes the compiler error. I suggest you open an issue on the [CreateJS-Haxe GitHub repo](https://github.com/nickalie/CreateJS-Haxe). – Gama11 Nov 22 '15 at 20:21
  • Awesome! Also this is a different question, but how do I run the .js file in terminal? – Vincent Le Nov 22 '15 at 20:52
  • 1
    While that [might be possible](http://stackoverflow.com/a/8533057/2631715), it's quite unusual. .js files are [generally executed in a browser](http://haxe.org/manual/target-javascript-getting-started.html#run-the-javascript). – Gama11 Nov 23 '15 at 08:10
  • ...unless explicitly targeted at non-browser environments (such as Node.js), which is not the case here, given that it works with HTML5 canvas. – D-side Nov 23 '15 at 14:41