In Haxe hxml file, how to target main class not in the root package

大兔子大兔子 提交于 2019-12-13 02:58:46

问题


I'm trying to compile a project where the main entry point isn't in the root package (which virtually all examples use, e.g. -main Main), but I keep getting this error message:

Error: Invalid commandline class : rtp.qt.QTPrinter should be QTPrinter

Here are the various syntaxes that should work:

-cp src
-main rtp.qt.QTPrinter

Or:

-cp src
-main rtp/qt/QTPrinter.hx

回答1:


It turns out, those syntaxes are both fine. I had just moved the QTPrinter.hx file from src/ to src/rtp/qt/ directory and I forgot to update the package statement at the top of the file (hence the invalid commandline class error.)

In my src/rtp/qt/QTPrinter.hx file, fix the package statement:

package rtp.qt;

I'm posting this mistake in hopes it helps someone. Cheers!



来源:https://stackoverflow.com/questions/35952115/in-haxe-hxml-file-how-to-target-main-class-not-in-the-root-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!