"Does not have a constructor" Problem

I’m developing a game being programmed in Haxe, openfl. I do the art and animation and work with a programmer. I am trying to get the game to build so I can quickly update and change the art assets.

However after installing haxe and openFL I keep getting told that specific file “does not have a constructor” Me and the programmer are using the exact same systems and sublime. He does not get this error. I have tried adding in a constructor which only creates more errors related to constructors.

I have a sneaky suspicion it may have something to do with Stencyl ( Which I also use to develop games ) which uses Haxe and HaxeFlixel I believe.

Appreciate the help,

I think your suspicion is probably correct.

A while back I played around with Stencyl, I wanted to do some quick prototyping in it, but quickly I discovered it had broken my existing OpenFl install.

I think it changes a bunch of your haxelib paths to stencyl specific ones, though I can’t be much help beyond that at the moment. It’s been a while!

Mmm… Stencyl automatically installs Haxe and OpenFL, but into its own directory. Making Stencyl the most infuriating IDE on the planet (hence why I don’t use it). Despite that, there is a simple fix:

haxelib setup "path/to/my/haxelib/directory"

The path should be the path to all of your installed libraries, so if it’s in “C:\HaxeToolkit\lib” then that is what you would type. If you want to use Stencyl again, then you would have to reset the path of Haxe.

As I said, Stencyl is infuriating and a pain in the backside.

Hey Thanks for the help,
I did try changing my repository. I’m still getting the same error though unfortunately.

Can you provide the error message? It might help.

Hey Tienery,
This is the full message I get.

src/com/massivemonster/swordscouts/Sprites.hx:140: characters 15-31 : com.massivemonster.swordscouts.GameObject does not have a constructor
[Finished in 3.4s with exit code 1]
[cmd: ['haxelib', 'run', 'openfl', 'test', 'project.xml', 'cpp', '-debug']]
[dir: /Users/Julian/superadventurepals]
[path: /usr/bin:/bin:/usr/sbin:/sbin]

Does your class have a public function new () {} function?

The case maybe that when you enter a constructor into the class, that the compiler will then get further and report further missing constructors whenever you’re using the “new” keyword. It may just be the case of filling up the gaps.