Help using library from haxelib

I’d like to use thx.core’s Set type in a hello-world program.

This is with a regular command line setup on Debian and using an hl.hxml file to target HashLink.

I found the library listed at https://lib.haxe.org/p/thx.core/.

I installed it in the usual way: haxelib install thx.core, and see that it is indeed present in my ~/haxelib, albeit named with a comma (“thx,core”) rather than the dot which I expected (“thx.core”).

In my Main.hx, at the top I put import thx.core.Set;

In my hl.hxml file I added the line: -L thx.core

When I run haxe hl.hxml I get the error:

src/Main.hx:1: characters 8-20 : Type not found : thx.core.Set

Where am I going wrong?

The syntax to include a lib is -lib thx.core,
see Getting Started - Haxelib Documentation for more documentation on haxelib.

Thanks Valentin, but changing -L thx.core to -lib thx.core in my hl.hxml file doesn’t seem to affect anything (and I see from haxe --help that it looks like the newer usage is -L|--library, rather than -lib).

It should be thx.Set, not thx.core.Set :wink:

Ah! Thanks, Andy. I was just looking into ~/haxelib/thx,core/0,43,0/src noticing that there’s a thx/Set.hx rather than thx/core/Set.hx file… :slight_smile:

So, I changed my Main.hx to say, import thx.Set;, and … I get other errors; though at least it looks like they’re errors from the library. I’m following the thx.Docs, but

var set = Set.create();

fails with

src/Main.hx:5: characters 19-29 : thx.Set has no field create

and

var s : Set<Int> = [1, 2, 3, 1];

fails with:

src/Main.hx:5: characters 9-41 : Array<Int> should be thx.Set<Int>

Thanks.

Oh, whoops. I was looking at thx.core instead of thx.Set - thx libraries . I see that Set.createInt() works. Thanks!