Giter Club home page Giter Club logo

vscode-remote-try-cpp's Introduction

Try Out Development Containers: C++

Open in Dev Containers

A development container is a running container with a well-defined tool/runtime stack and its prerequisites. You can try out development containers with GitHub Codespaces or Visual Studio Code Dev Containers.

This is a sample project that lets you try out either option in a few easy steps. We have a variety of other vscode-remote-try-* sample projects, too.

Note: If you already have a Codespace or dev container, you can jump to the Things to try section.

Setting up the development container

GitHub Codespaces

Follow these steps to open this sample in a Codespace:

  1. Click the Code drop-down menu.
  2. Click on the Codespaces tab.
  3. Click Create codespace on main .

For more info, check out the GitHub documentation.

VS Code Dev Containers

If you already have VS Code and Docker installed, you can click the badge above or here to get started. Clicking these links will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a dev container for use.

Follow these steps to open this sample in a container using the VS Code Dev Containers extension:

  1. If this is your first time using a development container, please ensure your system meets the pre-reqs (i.e. have Docker installed) in the getting started steps.

  2. To use this repository, you can either open the repository in an isolated Docker volume:

    • Press F1 and select the Dev Containers: Try a Sample... command.
    • Choose the "C++" sample, wait for the container to start, and try things out!

      Note: Under the hood, this will use the Dev Containers: Clone Repository in Container Volume... command to clone the source code in a Docker volume instead of the local filesystem. Volumes are the preferred mechanism for persisting container data.

    Or open a locally cloned copy of the code:

    • Clone this repository to your local filesystem.
    • Press F1 and select the Dev Containers: Open Folder in Container... command.
    • Select the cloned copy of this folder, wait for the container to start, and try things out!

Things to try

Once you have this sample opened, you'll be able to work with it like you would locally.

Some things to try:

  1. Edit:

    • Open main.cpp
    • Try adding some code and check out the language features.
    • Make a spelling mistake and notice it is detected. The Code Spell Checker extension was automatically installed because it is referenced in .devcontainer/devcontainer.json.
    • Also notice that utilities like Vcpkg and the C++ extension are installed. Tools are installed in the mcr.microsoft.com/devcontainers/cpp image and Dev Container settings and metadata are automatically picked up from image labels.
  2. Terminal: Press ctrl+shift+` and type uname and other Linux commands from the terminal window.

  3. Build, Run, and Debug:

    • Open main.cpp
    • Add a breakpoint (e.g. on line 7).
    • Press F5 to launch the app in the container.
    • Once the breakpoint is hit, try hovering over variables, examining locals, and more.
  4. Install the GitHub CLI using a Dev Container Feature:

    • Press F1 and select the Dev Containers: Configure Container Features... or Codespaces: Configure Container Features... command.
    • Type "github" in the text box at the top.
    • Check check box next to "GitHub CLI" (published by devcontainers)
    • Click OK
    • Press F1 and select the Dev Containers: Rebuild Container or Codespaces: Rebuild Container command so the modifications are picked up.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

License

Copyright © Microsoft Corporation All rights reserved.
Licensed under the MIT License. See LICENSE in the project root for license information.

vscode-remote-try-cpp's People

Contributors

alexr00 avatar bamurtaugh avatar chuxel avatar cmaneu avatar lostintangent avatar microsoftopensource avatar msftgits avatar samruddhikhandale avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-remote-try-cpp's Issues

Cannot install vscode-server on remote linux server through a x display.

I use windows host and connect to a remote Linux server using mobaxterm and x display. So I can run the VSCode on the Linux server and display it locally. But when I try this repo using remote-containner plug-in, I get stuck on installing the vscode-server locally. Some error messages like below:
"vscode remote container at tlswrap. onstreamread internal//stream_base_commons.js "
Does my set-up work with remote-container? Or I have to use remote-ssh and remote-container together to get this done?
Thx!

Yaourt cake

Yaourt cake doit être ajouté a l'index 2

ms-vscode.cpptools must be manually installed in container before breakpoint can be set

host: macOS Monterey 12.6 (Intel)
docker: 4.15.0 (93002)
vscode: Version: 1.54.1 (Universal) Commit: f30a9b73e8ffc278e71575118b6bf568f04587c8

REPRO

vince@aeris tmp % git clone https://github.com/Microsoft/vscode-remote-try-cpp
Cloning into 'vscode-remote-try-cpp'...
remote: Enumerating objects: 141, done.
remote: Counting objects: 100% (21/21), done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 141 (delta 6), reused 18 (delta 5), pack-reused 120
Receiving objects: 100% (141/141), 57.20 KiB | 1.06 MiB/s, done.
Resolving deltas: 100% (61/61), done.
vince@aeris tmp %

vscode Open folder: ~/tmp/vscode-remote-try-cpp

try to set breakpoint in main.cpp (doesn't work)

Go to extensions, install cpptools, then I'm able to set a breakpoint.

Feature: Adding Alpine based development container

Context

Presently we have a Debian based development container. Using Alpine Linux as another choice would be great as a base image for the development container. As per the vs code remote documentation, Alpine Linux is not currently supported.

If the user is happy with alpine based commands then we can have lightweight and fastly built development containers.

I would like to be a part in implementing the Alpine Linux based vs code remote as another git repo as vscode-remote-alpine-try-cpp

Unable to start debugging in VSO

I cloned this project in VSO, when try to debug I got:

Unable to start debugging. Launch options string provided by the project system is invalid. Unable to determine path to debugger. Please specify the "MIDebuggerPath" option.

Error Installing lsb-release package

Installing on MacOS Mojave, Docker 2.0.0.3

Package lsb-release is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'lsb-release' has no installation candidate
The command '/bin/sh -c apt-get -y install git procps lsb-release' returned a non-zero code: 100

VSCode remote cpp debug not working

I am using windows 7 and connect to arch using ssh.
I git clone this repo, and tried to use it.
I am able to compile this repo, but when I press F5 to debug it with breakpoint set to line 7.
Things just hang from here. The program is not running. the left top conner has a little blue block running nostop.

I get terminal result:

Executing task: g++ -g main.cpp -o main.out <
Terminal will be reused by tasks, press any key to close it.

With launch.json set to :

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Main",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/main.out",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "logging": {
                "trace": true,
                "traceResponse": true,
                "engineLogging": true
            },
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "Build Main"
        }
    ]
}

And my debug console has output as following:

--> E (output): {"event":"output","body":{"category":"console","output":"1: (268) LaunchOptions<LocalLaunchOptions xmlns='http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014'\n"},"seq":2,"type":"event"}

1: (268) LaunchOptions<LocalLaunchOptions xmlns='http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014'

--> E (output): {"event":"output","body":{"category":"console","output":"1: (291) LaunchOptions  ExePath='/home/sqliu/workspace/vscode-remote-try-cpp/main.out'\n"},"seq":4,"type":"event"}

1: (291) LaunchOptions  ExePath='/home/sqliu/workspace/vscode-remote-try-cpp/main.out'

--> E (output): {"event":"output","body":{"category":"console","output":"1: (292) LaunchOptions  WorkingDirectory='/home/sqliu/workspace/vscode-remote-try-cpp'\n"},"seq":6,"type":"event"}

1: (292) LaunchOptions  WorkingDirectory='/home/sqliu/workspace/vscode-remote-try-cpp'

--> E (output): {"event":"output","body":{"category":"console","output":"1: (292) LaunchOptions  ExeArguments=''\n"},"seq":8,"type":"event"}

1: (292) LaunchOptions  ExeArguments=''

--> E (output): {"event":"output","body":{"category":"console","output":"1: (293) LaunchOptions  MIMode='gdb'\n"},"seq":10,"type":"event"}

1: (293) LaunchOptions  MIMode='gdb'

--> E (output): {"event":"output","body":{"category":"console","output":"1: (294) LaunchOptions  MIDebuggerPath=''\n"},"seq":12,"type":"event"}

1: (294) LaunchOptions  MIDebuggerPath=''

--> E (output): {"event":"output","body":{"category":"console","output":"1: (295) LaunchOptions  WaitDynamicLibLoad='false'\n"},"seq":14,"type":"event"}

1: (295) LaunchOptions  WaitDynamicLibLoad='false'

--> E (output): {"event":"output","body":{"category":"console","output":"1: (295) LaunchOptions  ExternalConsole='true'\n"},"seq":16,"type":"event"}

1: (295) LaunchOptions  ExternalConsole='true'

--> E (output): {"event":"output","body":{"category":"console","output":"1: (296) LaunchOptions>\n"},"seq":18,"type":"event"}

1: (296) LaunchOptions>

--> E (output): {"event":"output","body":{"category":"console","output":"1: (296) LaunchOptions    <SetupCommands>\n"},"seq":20,"type":"event"}

1: (296) LaunchOptions    <SetupCommands>

--> E (output): {"event":"output","body":{"category":"console","output":"1: (297) LaunchOptions        <Command IgnoreFailures='true' Description='Enable pretty-printing for gdb'>-enable-pretty-printing</Command>\n"},"seq":22,"type":"event"}

1: (297) LaunchOptions        <Command IgnoreFailures='true' Description='Enable pretty-printing for gdb'>-enable-pretty-printing</Command>

--> E (output): {"event":"output","body":{"category":"console","output":"1: (297) LaunchOptions    </SetupCommands>\n"},"seq":24,"type":"event"}

1: (297) LaunchOptions    </SetupCommands>

--> E (output): {"event":"output","body":{"category":"console","output":"1: (298) LaunchOptions</LocalLaunchOptions>\n"},"seq":26,"type":"event"}

1: (298) LaunchOptions</LocalLaunchOptions>

--> E (output): {"event":"output","body":{"category":"console","output":"1: (516) DbgCmd:echo $$ > /tmp/Microsoft-MIEngine-Pid-zq1tm9f4.x8p ; cd /home/sqliu/workspace/vscode-remote-try-cpp ; DbgTerm=`tty` ; set -o monitor ; trap 'rm /tmp/Microsoft-MIEngine-In-kuo56ybr.bv1 /tmp/Microsoft-MIEngine-Out-ycj4h548.94t /tmp/Microsoft-MIEngine-Pid-zq1tm9f4.x8p /tmp/Microsoft-MIEngine-Cmd-ws0ei0oy.rbc' EXIT ; /usr/bin/gdb --interpreter=mi --tty=$DbgTerm < /tmp/Microsoft-MIEngine-In-kuo56ybr.bv1 > /tmp/Microsoft-MIEngine-Out-ycj4h548.94t & clear; pid=$! ; echo $pid > /tmp/Microsoft-MIEngine-Pid-zq1tm9f4.x8p ; wait $pid; \n"},"seq":28,"type":"event"}

1: (516) DbgCmd:echo $$ > /tmp/Microsoft-MIEngine-Pid-zq1tm9f4.x8p ; cd /home/sqliu/workspace/vscode-remote-try-cpp ; DbgTerm=`tty` ; set -o monitor ; trap 'rm /tmp/Microsoft-MIEngine-In-kuo56ybr.bv1 /tmp/Microsoft-MIEngine-Out-ycj4h548.94t /tmp/Microsoft-MIEngine-Pid-zq1tm9f4.x8p /tmp/Microsoft-MIEngine-Cmd-ws0ei0oy.rbc' EXIT ; /usr/bin/gdb --interpreter=mi --tty=$DbgTerm < /tmp/Microsoft-MIEngine-In-kuo56ybr.bv1 > /tmp/Microsoft-MIEngine-Out-ycj4h548.94t & clear; pid=$! ; echo $pid > /tmp/Microsoft-MIEngine-Pid-zq1tm9f4.x8p ; wait $pid; 

--> C (runInTerminal-30): {"command":"runInTerminal","arguments":{"kind":"external","title":"cppdbg: main.out","cwd":"","args":["sh","/tmp/Microsoft-MIEngine-Cmd-ws0ei0oy.rbc"],"env":{}},"seq":30,"type":"request"}

--> E (output): {"event":"output","body":{"category":"console","output":"1: (553) Wait for connection completion.\n"},"seq":32,"type":"event"}

1: (553) Wait for connection completion.

installing cpp extension offline

hi,

I'm due to company proxy, in having problems
with "platform-specific binary dependencies"
for cpp extensions (pop-up errors and not working extension)
This is a know issue with this extension and workaround for it is to install binaries from local copy.
This seems easy but I cannot make it work.

This is my unsuccessful attempt:
download vscx and add it to dockerfile,
then in devcontainer.json add
$ code --instal-extension cpptools-linux.vscx
to onCreateCommand.

This command works in vscode terminal and installs binaries without any problem.

..but..

running it in "onCreateCommand" endeds up in:
"code or code-insiders is not installed".

could you please help me resolving this issue?

Debugging vscode-remote-try-cpp on an external server in the cloud unavailable

The instructions for titled "Remote development in Containers" were published a few days ago (2020-09-10) and are located here:
https://code.visualstudio.com/docs/remote/containers-tutorial#cpp-articles

I am specifically interested in doing this using C/C++, so this projects is super interesting to me. I've tried both methods:

  1. [Automatic] Calling the plugin within Visual Studio Code: "Remote-Containers: Try a Sample..." -> "C++"
  2. [Manual] Performing a Git clone on "vscode-remote-try-cpp", opening the folder, Terminal->Run Build Task, Run->Start Debugging.

Both of the two ways of doing things are very effective and work. In the first method, I don't even see the source code locally, it is placed in the container directly is seems.

The next step I want to perform is running this project on a compute node in the cloud (start the containers and the main.cpp app). How would I specify to do this? Would this be modifying /vscode-remote-try-cpp/blob/master/.vscode/launch.json and put the IP address and the port of the remote target?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.