Get Started with Visual C++ for Linux Development
Setting up your project for Linux Development
With this extension you can author C++ code for Linux servers, desktops and devices. You can manage your connections to these machines from within VS. VS will automatically copy and remote build your sources and can launch your application with the debugger. Our project system supports targeting specific architectures, including ARM.
Support
You can reach us directly via email at vcpplinux-support@microsoft.com
You can also reach us on github at https://github.com/Microsoft/VSLinux/issues
As of November of 2016 the Extension Gallery does not have a comments section anymore. Please use our support email or our github page to start a discussion and report issues.
This extension is no longer supported in Visual Studio 2015. It can still be installed by won't be updated further. This extension was integrated into Visual Studio 2017, which can be installed from https://www.visualstudio.com/downloads/. Once installed, you can install Visual C++ for Linux Development by selecting the "Linux development with C++" workload.
Updates
4/4/2018
- This extension won't receive further updates in Visual Studio 2015. We integrated all the capabilities of the extension into Visual Studio 2017, where we also made considerable updates, and added major new features. Linux will continue to be a considerable investment for us, with the development focused in Visual Studio 2017. See above for more details. If you have any concerns or questions, you can open an issue for us, to start a discussion, at https://github.com/Microsoft/VSLinux/issues, or you can write us at vcpplinux-support@microsoft.com.
4/26/2017 v1.0.7
- Natvis
- python pretty printing for gdb mode
- source mapping to debug the right source file when debugging files with the same name
- child process debugging
- debug attach, to remote processes (using Attach to Process dialog)
- ctrl+f5 run without debugging
- required remote tools dependencies checks, makes sure gdb/gcc etc is installed
- message reporting usability improvements from compiler/linker
- fixing a bug with shellexec processes being orphaned and leaked in the system
- fix a bug with connections being invalidated due to a date time bug
- fix for a crash occuring sometimes when adding a connection in the Connection Manager
- fix for a crash when a command timeouts
- fix for a crash which occurs sometimes when errors occur from the shell when executing commands
- pass the machine name to command line builds using /pp:RemoteTarget=name
12/21/2016 v1.0.6
- Incremental linking
- Incremental build output logging
- Bug fix for file path issues when using multiple connections
- Shared projects support bug fix
- Updated the data collection policy to opt-out in the installer
- Debugging error reporting improvements
- Property Pages for timeout properties
- Misc simplifications in the Property Pages, removed the Remote page
- Improved Linux systems identification
- Improved build cancellation support
- Options for not copying object files and the build output files locally, from the remote system
- Overall faster build times
- Removed dependency block on Update 3
8/19/2016 v1.0.5
- Major performance improvements with incremental copy and build, and considerably reducing the number of connections
- Makefile project support for external build system support (make, CMake etc.)
- Overridable C/C++ compiler path in Property Pages
- Remote source copy management per file/project: no copy, and/or override destination path
- Debug command override, useful for debugging external programs
- Pre-build and Pre-link remote build events
- Arbitrary file copy as part of the build events
- Overridable timeouts through project for command execution, compile, link and archiver:
- Add elements to project file under to override default value of 30 minutes. Values are: RemoteExecuteTimeout, RemoteCompileCommandTimeout, RemoteLdCommmandTimeout, or RemoteArCommmandTimeout
- Debugging Property Page support for additional gdb commands for the debugger to run before starting debugging (debugger bootstrap commands)
- Linux console hang during infinite loops bug fix
- Default to IPv4 when using hostnames
- Custom local/remote ports ignored bug fix
- Linker error parsing updates
- Fixed "``" escaping issue
- uname -m machine arch parsing bug fix
- Remote project directory is set to a system directory bug fix
- MIEngine bits moved up to Update 3
7/8/2016 v1.0.4
- Bug fix for new source files in empty projects
- Added clean support
- Fixes bugs in remote target changes not triggering new build required
- Use first successful connection, instead of last successful, as the default connection
- General performance improvements
- Major IntelliSense fixes
- New experimenal debugging mode, gdb over the shell, which offers greater compatibility
6/6/2016 v1.0.3
- Added a console I/O Tool Window for interacting with remote process launched from VS
- Added support for working directory and command line arguments for the debugged process
- Added ability to use files outside the project directory
- UI for system information (OS/architecture) in the Tools – Options
- C++14 support IntelliSense bug fix
- Connect to Linux dialog UI bug fixes
- Linux Connections UI remove connection after add bug fix
- Fixes an access denied bug when uploading read only files
- Fixes -x c, -x c++ bug and compiling as C
- FreeBSD, OSX partial support, including connections, compile and link. Debugging is not supported yet.
- Performance improvements
4/14/2016 v1.0.2
- Removed the dependency on Android NDK and Android MDD bits
- Intel Edison support and bug fixes
- Fix for login as root
- Fixes the ocassional "4444 port in use"
- Fixes the "no such file" bug
- Local and remote ports in the Property Pages are not dependent on each other and each can be supplied individually
- Fixes a bug with removing entries from Linux Connection Manager
- Resource management (leaked sshd processes) fixes
- General robustness fixes in the Connect dialog
- Gdbserver cleanup at the end of debugging
- Improved build diagnostics and linker errors parsing from build
- Fix for empty output file name extension, now the output can have no file extension
4/4/2016 v1.0.1
3/30/2016 v1.0
Create a Linux Project
After installing the extension to get started create a new project by going to Templates > Visual C++ > Cross Platform > Linux.
Connecting to Linux
Prerequisites
Today we only support building remotely on the Linux target machine. We are not limited by specific Linux distros but we do have dependencies on the presence of some tools. Specifically, we need openssh-server, g++, gdb and gdbserver. Use your favorite package manager to install them, e.g. on Debian based systems: sudo apt-get install openssh-server g++ gdb gdbserver
First connection
The first time you target a Linux machine you will be prompted for connection information. This is triggered by building the project.
Adding and removing connections
To add a new connection, go to Tools > Options and search for Linux. You can also search Linux in the qucik launch box. From here you can add and remove connections.
To change which connection a project is using go to the project properties remote settings and update the target machine.
Project Properties
All of the options necessary to control C++ compilation are exposed on the project properies pages. We'll cover a few specific to how things work for Linux. First under remote settings, you will see the remote root is set to ~/projects/ by default and that we are setting the remote project directory to match our project name in that location.
Looking at the General settings for the project, you can see how our output and intermediate directories are configured. By default a project configured as an application will result in an executable under bin/x64/Debug/ under the project directory location. Notice that for configuration types we also support static and dynamic libraries.
Add additional library dependencies on the Linker > Input property page.
You can pass additional pre launch commands to the debugger to do things like launch graphical apps on the remote linux machine.
You can also send post build events to control remote behavior, as in this example that exports a gpio pin for use without requiring the executable run as super user.