Reputation: 537
Why package declarations like in below two files couses compiler errors, and how to achieve having my declared package on both files (with Main included)?
File Main.hx
package foo;
class Main {
function new() {
var x:A = new A();
}
static function main() {
var main = new Main();
}
}
File A.hx
package foo;
class A {
public function new() {
trace('Hi.');
}
}
Upvotes: 2
Views: 180
Reputation: 34128
Try structuring your project like this:
[project root]
/source
/foo
Main.hx
A.hx
Then call Haxe with these arguments, with [project root]
as the current working directory:
haxe -cp source --interp -main foo.Main
The name of source
doesn't really matter, it could be src
or Source
, but the directory the .hx
files are placed in needs to match their package (foo
).
Upvotes: 3