1

I want to use kotlinc to compile multiple files that are organized in folders, like in this minimal example:

enter image description here

Main.kt only calls helper.kt which contains

enter image description here

When I call: kotlinc *.kt -include-runtime -d Main.jar

I get the error

enter image description here

I guess the problem is that *.kt doesn't compile files nested in folders. How do I change that? I didn't find a flag for it in the kotlinc documentation.

Moritz Groß
  • 1,352
  • 12
  • 30
  • 3
    (Not done enough research to justify posting this as an answer…) It's usually best to use a build tool such as Gradle, Maven, or IntelliJ. If you really need to call `kotlinc` manually, I think you'll include all the .kt files. How you do that will depend upon your OS and/or shell; e.g. in zsh you could just use `kotlinc **/*.kt`; for general Unix-like shells you could do something like `find . -name '*.kt' | xargs kotlinc`. – gidds Dec 09 '21 at 22:28
  • I used Git Bash on windows for it, thanks for the idea – Moritz Groß Dec 09 '21 at 22:33
  • @gidds that did the trick! – Droid Chris Jul 20 '23 at 17:53

0 Answers0