Setting Up Visual Studio for Rock Pi 4


I tried to find an IDE to code on Rock Pi 4. My first 2 choices are Atom and Sublime, unfortunately none of them supports ARM/ARM64. Fortunately, Visual Studio, which I use on a daily basis, is capable to do it – remotely from Windows PC. It took me hours to make it work, I’m posting my experiences here so you don’t have to repeat my mistakes.

Microsoft Visual Studio Community Edition is free, and has all the features I need so far. When you install it, check Workloads/Linux development with C++, plus Optional Cmake and Linus.

My first 2 bummers are on the Rock Pi 4 side:

  1. openssh-server doesn’t work on Rock Pi ARM64 build (following the official instructions) out of the box, you need to purge then reinstall it.
  2. sudo apt-get install rsync

Now, on Windows side, create a Raspberry Pi project, connect to your Rock Pi 4. The sample code needs wiringPi so it won’t work, clean up the code and write something else, like the code in my screenshot, and set architecture to ARM64 (in case you are running Debian ARM64 or Ubuntu). I didn’t do this on the armhf build.

Now the 3rd bummer, IntelliSense reports errors on everything (if the architecture was set to ARM it’s fine), because you don’t have the ARM64 headers on your Windows PC. Go to Tools->Options->Cross Platform -> Connection Manager -> Remote Headers IntelliSense Manager, update the headers from your connection, all the errors should go away.

I had another issue at this point, Visual Studio pops up some “tty” error, and turned out to be the tmux running in my ssh session. Remove it the error is gone - and yes you can’t start tmux automatically if you wan’t to use Visual Studio.

The code compiled, I can set break points and everything. There is a compiler waning like “implicit declaration of function ‘…’ something”, add “#define _GNU_SOURCE” at top of your code will clear it up.

The next thing, after I included the new libmraa and make a call to mraa_init(), the linker compliants “undefined reference to ‘mraa_init’”, WTH? because the linker is looking for but there is only You need go to the Project Configuration Properties -> Linker->Command Line, add “-lmraa” as additional option, the link will find it. (Is there a better way anyone?)

If you are running Debian ARM64 on your Pi like me, you are out of luck. It doesn’t have libjsonc, which you could install it using apt-get, but then you are missing glibc 2.27, I haven’t fixed this yet, but the errors are synced up with the mraa executable on your Pi - it’s broken too.

Try it out, have fun!


Thanks for sharing. I think this is a cross-compiling development setup?

For libmraa broken on debian arm64, you can build from source code. We will also update the package built from arm64 debian.


Thanks, no wonder I didn’t find the source code in Radxa repositories


That’s good guide, but you could just use Monodevelop


Thanks I will check it out. Meanwhile I found this could be more favorable for many. This way, you can carry your code on your laptop anywhere, and run your code on different Pi’s - a huge advantage if you want to test it in different environment.


OK that is the original mraa repository, do I need to mod anything for Rock Pi 4?

I see, libmraa officially supports Rock Pi 4 now, in types.h:
MRAA_ROCKPI4 = 20, /< Radxa ROCK PI 4 Models A/B /*
Good job! My code works! Calling mraa_get_platform_name() returns “ROCK PI 4B”.

run mraa-uart list
0. ---- error reading uart information ----
my uart2 and uart4 are turned on, does it look right?


Hello mraa