![]() To run a container based on this image so that VS Code can debug processes in it, type the following on a terminal inside the folder, in which your source code is located: docker run -d -p 2222:22 -security-opt seccomp:unconfined -v $PWD:/source -name gdb-cpp-image gdb-cpp-image The image will be built with a name gdb-cpp-image. To build this image, type the following on a terminal inside the folder, in which you created the Dockerfile file: docker build -t gdb-cpp-image. The following lines install and enable SSH with user and password root:root and expose the port 22. The second one includes the libraries required for my C++ application. The first one is required to remotely build and debug applications. In this case, for example, you see that I included two apt-get install -y lines. You should consider that this Docker image should have all libraries that you need to compile your application. I like to use Debian images because of Debian simplicity. & sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \ # configure SSH for communication with Visual Studio Libncurses5-dev libncursesw5-dev libasio-dev libboost-all-dev RUN apt-get install -y libopenblas-dev liblapack-dev python3-dev \ ![]() & apt-get install -y g++ build-essential make cmake gdb gdbserver \ # install build dependencies to build and debug LABEL description="Container for use with Visual Studio" Creating a container to use with VS CodeĬreate a Dockerfile inside a folder and add the following in that file: FROM debian:bullseye If you need some help to install extesions on VSCode, please follow the official tutorials. To compile and debug applications on VSCode, you should install the following extensions: You'll need to setup a launch task that will debug the application.You'll need to setup a task that will compile the application code.This container will be accessed via SSH to compile the application A container will be started using this image and the source code will be linked using the volume option of Docker. You need to build a Docker image with the tools/dependencies/libraries etc.The steps are divided in three main groups: This article is a documentation for me that I will use every time that I need to compile a C++ application. I found that VSCode has the capability to target a container for application building and/or debugging :). Last week, I was working on a C++ application on a remote machine in the cloud, and I didn't want to install all the compiling and debugging tools/libraries/dependencies on the host OS, but I wanted to have all of them in a container. Debugging C++ in a container with VS Code.Building C++ in a container with VS Code.Creating a container to use with VS Code.You're literally a few clicks away from starting to code. Fortunately there's a host of these both from Microsoft and third-parties that you can install right from within Visual Studio Code. The stock install of Visual Studio Code is deliberately barebones and lightweight, so you'll need to spec it out to your requirements with extensions. If you are on an ARM Chromebook, download the ARM version of the installer, if you're on an AMD or Intel Chromebook, you want the 圆4 installer. The September 2020 update of Visual Studio Code added support for ARM-based Linux machines, which means you can now use it on devices like the Lenovo Chromebook Duet. When downloading the installer make sure you grab the right version for your Chromebook. You can also launch it from the terminal simply by typing code. Source: Windows Central (Image credit: Source: Windows Central)įrom here on out you'll be able to launch Visual Studio Code from the app drawer like any other application on your Chromebook once the Linux installer has finished.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |