VS Code: Building the Project

In a previous article I have imported an example project. Now I want to compile and build it.

Traditionally, the build action inside VS Code is somewhat hidden. There is a keyboard shortcut, but recent additions to VS Code making the build action more accessible.

Multiple ways to start a build in Visual Studio Code

To build a project, you have multiple options.

CTRL+SHIFT+B

One standard way in VS Code is to use the CTRL+SHIFT+B:

CTRL+SHIFT+B

This gives the actions to build or clean the project.

The output is shown for example in the Terminal:

Another place is the Output area for CMake/Build:

Toolbar Icon

Yet another way is to use the build icon in the bottom toolbar:

Build action in bottom toolbar

The same icon is present to build the selected project:

Build action on project list

Context menu

The context menu on the project offers the same action, among others:

Build action on project list context menu

Build errors

Should the build fail with an error, then this is indicated in different places in VS Code. Check the ‘Problems’ in the bottom area, where you can double-click on the message to jump to the source location:

Failed build with an error

Command Line

As the project is CMake based, I can easily build project from the command line. In the output view I can see what command is used:

I can open the project folder with the integrated terminal:

and using the commands to build it:

cmake --build armgcc/debug --config debug --target all

or to clean the project:

cmake --build armgcc/debug --config debug --target clean

Summary

With this, I can compile and build projects. If you are looking for a more advanced way, check out the usage of build tasks. Next step is to debug the project.

Happy making 🙂

Links

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.