haxe - Class not found : helloworld.Main -


i began learn haxe, have encountered compile error.

main.hx

package helloworld;  import js.lib;  class main {      static function main() {         lib.alert("hello world");     }  } 

please careful target class helloworld.main.

build.hxml

-js bin/helloworld.js -cp src -main helloworld.main -debug 

build process log

building helloworld_p140627 running pre-build command line... cmd: c:\haxetoolkit\haxe\haxe.exe x:\tmp\helloworld_p140627\build.hxml class not found : helloworld.main build halted errors. done(1) 

enter image description here

why? class helloworld.main surely exist. cannot "hello, world"?

update can see screenshot of project:

you trying compile "helloworld.main", means class called "main" in package "helloworld", haxe looking file called "helloworld/main.hx" in "src/" directory.

however have "src/main.hx", not "src/helloworld/main.hx". create subfolder called "helloworld", move "main.hx" in there , fine. package use in haxe must match directory structure.


make sure package aligns folders, , file name class name. , of these should inside 1 of "-cp" class path folders.

for example above, code looks fine, expect layout like:

build.hxml                  <-- build file src/helloworld/main.hx      <-- classpath/package/class.hx bin/                        <-- output folder bin/helloworld.js           <-- created once compiles 

and you'd run haxe build.hxml. if doesn't work please post exact file structure of project (which folders , directories), , command use build it, , output.

hope helps,


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -