1

I've been learning Swift for a little bit now, and I really want to use it. However, compiling Swift on Windows is quite a chore. I can do it from Visual Studio 2015 easily, but VS2015 support is very poor, and incredibly hard to work with; I would prefer to use Atom and the command line. I use RemObject's Silver to compile to .NET, but I can never get the command line to work.

When I use the Elements.exe at C:\Program Files (x86)\RemObjects Software\Elements\Bin, passing the filename as a parameter, it tells me that print is undefined.

Does anyone know how to use Silver's command line to compiler Swift?

nhgrif
  • 61,578
  • 25
  • 134
  • 173

2 Answers2

1

Have you tried referencing the online documentation?

calling elements needs some libraries to import:

elements --mode=ECHOES --reference=Swift myfile.swift
Chris
  • 7,830
  • 6
  • 38
  • 72
sh17
  • 11
  • 1
  • I tried the command, but it tells me that the two switches you gave were invalid, so I changed the two `-`s to one, and it started, but it still tells me that print is undefined and it can't find System.Linq. – Paolo Mazzon Mar 31 '16 at 00:00
0

I recommend using MSBuild, rather than Elements.exe, to build Elements projects from the command line. It's more complete and supports more advanced build tasks needed for some project types.

That said, --mode and --reference should definitely work. Can you post a complete command line and output?

You will need --reference=Swift in order for print() & co to be known, and --reference System.Core to use LINQ.

marc hoffman
  • 586
  • 1
  • 5
  • 14
  • [Here](http://i.imgur.com/TZyzFoj.png) is a screenshot of CMD when I attempt to execute the command. `=` and `:` are interchangable, and when I change the single dash to the double that you said should work, I get [this](http://i.imgur.com/LGlfX3I.png). Sadly, your suggestion doesn't work... But is there a way to use MSBuild outside of Visual Studio? The whole point of me trying to use the command line is to **not** use VS... – Paolo Mazzon Mar 31 '16 at 22:56
  • Can you try using the latest version of Elements, 8.3? We made a lot of improvements to the command line compiler. Yes, you can use MSBuild from the command line, just type "msbuild" — no Visual Studio needed or involved. – marc hoffman Apr 01 '16 at 11:42
  • Also, FWIW, `elements --reference=Swift foo.swift`, with two dashes, runs fine for me, and does recognize the --reference parameter... – marc hoffman Apr 01 '16 at 11:43