Skip to content
Advertisement

Application build . (Swift on Ubuntu)

I am a total newbie to programming and Ubuntu and Swift is my first language to learn.

I am learning with a book but I encountered a problem when I was supposed to build an application. Here is what I had to do:

Make a new directory called PMExample so that’s easy mkdir PMExample
and then go to this directory cd PMExample.

Then I had to use ~/swift package init and got 2 directories called Sources and Tests and a file Package.swift. So in the Sources folder there was one text file and I had to create another one to build an application.

And I did all those steps correctly, but now there is a problem. The book tells me to use swift build command. The book says that this will build the application and if all is well, I will have an executable application in the PMExample/.build/debug directory named PMExample…

But after ~/swift build while being in the PMExample dir, there isn’t any new directory called .build or anything. There are no errors popping up after using that ~/swift build command. Just nothing happens and I can’t understand what am I doing wrong.

Thanks in advance.

Advertisement

Answer

But after ~/swift build while being in the PMExample dir, there isn’t any new directory called .build or anything.

How do you know that? It is likely that you are not seeing the directory because it starts with a dot (it is called .build), therefore it is not shown by default with ls. You have to pass the -a argument to ls, such as in:

ls -a PMExample
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement