Visual C++ for Linux Updates

Marc Goodner

Updated 6/14/2016: We updated the original announcement post with the content below if you want a single page that covers everything about this extension. The below remains the same and just covers the updates from the original release.

We’re happy to provide an update on the VC++ for Linux extension which has a new release today. Go get it now (and come back). We’ve had a few drops since our initial release to make general improvements and to address your feedback. We’ll tell you here about some new features in this release, explain how your feedback has guided us, give some usage tips, and show you how to use the extension with the Intel Edison board for your IoT projects.

Please consider taking this short survey to help us learn more about how you approach cross platform development. We know there are a lot of different Linux systems out there used in many ways. We’d love to hear from you about how you are using the extension. We’re also interested in hearing directly from you, so if you are willing to be contacted, please let us know in the survey. Talking directly to people about how they are using this has already helped us tremendously and we’d like to improve further. We do hope to identify some people we can contact on a more regular basis when we need input or have early bits to try out.

We want to remind you though that things are still moving quickly. We’re making changes to the file that tracks the connections. On updates we overwrite the existing file which is no longer compatible which unfortunately means any existing defined connections are lost. We will stop doing that as our functionality starts to stabilize and mature.

Console window

The most visible change in this update is that we’ve added a console window for interacting with your remote executables. This window shows not just the output of your program but can also take input. To activate this window use the menu Debug, Linux Console. This is what it looks like in action.

Console Window

Here is a simple program you can try these features out with.

#include <cstdio>

void log(char filename[], char visitor[])
{
	FILE * pLog;
	pLog = fopen(filename, "a");
	if (pLog != NULL)
	{
		fputs(visitor, pLog);
		fputs("\n", pLog);
		fclose(pLog);
	}
}

int main(int argc, char* argv[])
{
	if (argc != 2) 
	{
		printf("Please pass filename as input parameter\n");
		return 1;
	}
	char input[20];
	printf("What IDE are you using?\n");
	scanf("%19[0-9a-zA-Z ]", input);
       printf("%s! You can use that with me?!\n", input);
	log(argv[1], input);
       return 0;
}

Specify a filename in the Command Arguments input on your project’s Debugging property page. You can set a working directory on that page as well, if it is not set your home directory will be the working directory.

Debug Property Page

Reported issues

We want to thank everyone who has been reporting issues to us. Your feedback is very important. It does more than just help us prioritize things we know about, it helps us identify and fix the things we didn’t know about. Our very first update was to address a crash report that we hadn’t encountered before. Some of the other things like access denied with read only files we hadn’t come across in our testing yet. It would have taken us a long time on our own to encounter that but it was critical for a source control work flow that was reported to us. Some of the other things may have been things we were aware of, knowing they mattered raised their importance.

Here is a sampling of issues that were reported by our users. You’ll find a full list of changes at the end of this post.

  • Crash during logon
  • Added support for working directory and command line arguments for the debugged process
  • Added ability to use files outside the project directory
  • Fixes an access denied bug when uploading read only files
  • Fix for login as root
  • Fix for empty output file name extension, now the output can have no file extension

Again, thank you for your feedback and keep it coming.

Verbose build output

We’ve gotten a lot of questions about what exactly are the arguments being passed to GCC. Our build output doesn’t make this obvious, but you can enable it. There are two ways to get to the same place to change this setting. In the quick input window search for “verbosity”, or under Tools, Options go to Projects and Solutions, Build and Run. Now for the option of MSBuild Project output verbosity change it to diagnostic to see everything in your output window when you build. This can really help you find what exactly was passed to GCC to build your program if you are having issues.

Getting your include files

Everyone loves IntelliSense, but we’re not yet synchronizing the include files from your Linux system. Everyone has their own ways to either share or copy these files which is great. I wanted to share a really simple way to accomplish this I used in prepping the next section on the Intel Edison. I simply grab the whole folder locally onto my Windows box using PSCP.

pscp -r root@192.168.2.15:/usr/include .

Now on your project properties go to the VC++ Directories page and add your local path.

How to use the VC++ for Linux with the Intel Edison board

Using the VC++ for Linux extension with the Intel Edison board is largely like any other Linux system. First you’ll want to make sure you’ve setup your device following Intel’s instructions. You should be able to connect to your Edison via our connection manager once you have connected it to your Wi-Fi network. If you need a direct connection to your Edison use these instructions for using Ethernet over USB with your Edison which will also work with our connection manager.

The Edison makes it easy to start building an IoT application with sensor data. Accessories like the Arduino shield open make it easy to connect add-ons like the Grove shield from Seeed Studios. That shield lets you use any of the many available Grove sensors without having to worry about wiring a circuit on a breadboard, you can just get straight to your code. Intel has made this even easier to use with their UPM sensor library that covers a broad range of sensor including the Grove ones.

Shown here is an Edison compute module on an Arduino expansion board with a Grove shield attached and a temperature sensor plugged in.Edison module

In Visual Studio, create a new project, and under VC++, Cross Platform, Linux select Empty Project. Make sure that you set your solution platform to x86 when targeting the Edison. Add a C++ file to the project and use the code from this Grove Temperature Sample from Intel. The UPM libraries are part of the default Yocto Linux image used on the Edison so no additional setup is needed to acquire them. You should change the include statement in the sample to properly reference their location as follows:

#include <upm/grove.h>

With that change, you are ready to build and run your code. Here you can see the output of this sample in Visual Studio’s debug mode. If you are wonder about that first output line the first read from this type of sensor is often a bit off.

Edison Debugging in VS

To enable IntelliSense follow the instructions above for copying your include files locally from your Edison. At this time, we do have an IntelliSense bug that impacts this sample that will be fixed in a future update.

In a future post we’ll cover taking this sample further by connecting it to Azure IoT Hub.

Changes

We always post our change logs on the Visual Studio Gallery page for the Linux extension, but here is the complete tally since our original release.

6/6/2016 1.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 occasional “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

  • Fixed crash during login

0 comments

Discussion is closed.

Feedback usabilla icon