How to connect Haxe project with Nape

883 Views Asked by At

I have a src folder, containing a Main.hx & compile.hxml. I run the command sudo haxelib install nape, which reported it ended successfully installing Nape 2.0.5.

In the Main.hx I posted the code from this page, and then I run haxe compil.hxml which gave me the error: characters 0-22 : Class not found : nape.geom.Vec2. I can conclude haxe doesn't 'see' Nape.

Sidenote: I use ubuntu 12.10.

How do I use the library in my code?

3

There are 3 best solutions below

0
On

If you are using openfl and got this same error then in project.xml

add this (as XML tag like the openfl one )


 <haxelib name="nape" />

2
On

What does your .hxml look like?

you should have a line like '-lib nape' to link with the nape library.

On a different side note: Why are you running haxelib with sudo? It should not be necessary.

1
On

I haven't used this library, but I know it was written in pre-macro times and used a special pre-processor for haxe, called caxe. Looking at github sources of the library I don't see much .hx files, mostly .cx. For example, there is nape/geom/Vec2.cx, but no nape/geom/Vec2.hx.

So, my assumption is the library should be precompiled first, probably by means of Makefile it comes packed with, however I wasn't able to find any documentation on the issue.