/ code

Windows Tip of the Week: Remote Server Development

Visual Studio 2017 offers a really cool feature set of cross platform development. You can build systems to run on Linux while using Visual Studio.

How?

When setting up Visual Studio, be sure to select "Linux Development with C++".

Surprisingly, it doesn't take up a lot of space. After the package is installed, restart Visual Studio.

Start a new project and head over to Visual C++ > Cross Platform > Linux

Select any of the options, I chose Console Application for this exercise.

You're going to get taken to a basic setup printing a message to the console. You can leave that, or add your own code:

#include <iostream>

using namespace std;

struct myData
{
	string firstName;
	string lastName;
	string telephoneNumber;
	short age;
};

int main()
{
	myData chris;

	chris.firstName = "Chris";
    	...
    
	cout << chris.firstName << endl;
    	...
    
	return 0;
}

This is a pretty basic application that doesn't do anything. However, it does prove a point to an awesome feature. Type whatever you want (as long as it works) and build your project. You'll be prompted for a hostname, username, port, and password. A Linux server is required (batteries not included). If you don't have the real estate to fire one up, maybe check out the Docker side of things with Visual Studio.

After you confirm your Linux server information, the project builds remotely.

1>------ Build started: Project: Classes, Configuration: Debug x64 ------
1>Validating sources
1>Copying sources remotely to '10.0.0.100'
1>Validating architecture
1>Starting remote build
1>Compiling sources:
1>main.cpp
1>Linking objects
1>Classes.vcxproj -> P:\Systems\Classes\Classes\bin\x64\Debug\Classes.out
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Pretty cool, yeah?

Go ahead and run the program. You get an interesting debug menu on Visual Studio.

"Linux Console Window" is your output via the remote server. Pretty fancy stuff. I was impressed with the options to be honest. A lot of people are used to editing locally and running remotely, but being able to do it with everyone's (maybe?) favorite IDE is pretty handy. I know this feature has been around for a while, but I was in the mood for playing with some C++ and decided to try it out. Between this and Windows Subsystem for Linux, I must be a die hard Linux fan to keep going back!

Windows Tip of the Week: Remote Server Development
Share this