February 22, 2019

Visual Studio 2015 and Linux (or Rasberry Pi)

I'm doing more coding for Linux (Raspberry Pi) with my hobby projects -- and most of Linux environments I have are headless.  Using VIM is ok, but I prefer to use full featured IDEs such as Eclipse and Visual Studio.

I read both Eclipse and VS supports remote development/debugging but I haven't tried with Eclipse yet.  I recently tried with Visual Studio and it works pretty well.  There are already many blogs and articles how to do -- so this posting is not about how-to, but rather a note/record.

Windows Side

There will be 4 project types: Blink (using GPIO), Console Application, Empty Project, Makefile Project.

Linux Side

It is assumed SSHd is installed and configured.

$ sudo apt-get install -y openssh-server g++ gdb gdbserver

For "Blink" sample project in VS, do this on RPi:

$ sudo apt-get install git-core
$ git clone git://git.drogon.net/wiringPi
$ cd wiringPi
$ sudo ./build

Test

  1. Run VS
  2. File > New > Project > Installed > Visual C++ > Cross Platform > Linux
  3. Select "Console Application (Linux)"
  4. It'll ask for SSH connection to Linux
  5. Back to the sample code, make sure the target platform is "ARM"
  6. Click on "Remote GDB Debugger"
On Linux side, you'll find "projects" directory under the configured user:

projects/
└── ConsoleApplication1
    ├── bin
    │   └── ARM
    │       └── Debug
    │           └── ConsoleApplication1.out
    ├── main.cpp
    └── obj
        └── ARM
            └── Debug
                └── main.o


"ConsoleApplication1.out" is the binary.

Please read the links in References to find more info.

VS Connection Manager

To add, edit connections:
Tools > Options > Cross Platform > Connection Manager

For existing project, go to Project Properties to change existing connections and other settings.

References