Develop software for Linux (Raspberry Pi) using Windows 10 and C++ Language

Hello forums,

So this sounds like it might be a weird one,and a long one, and all over the place, but here we go anyway.

I have a raspberry pi on the way and I want to use it to learn more about software development. I have been learning a little C++ through a course that I have been doing but I wanted to do something practical with this knowledge whilst broadening my programing horizons, so I would like to stick to C++ for the time being. But here is the kicker, I would very much like to able to do my coding on one of my 2 windows machines and push the code to the Pi.

After some investigation I found Qt, it promised to be cross platform etc but when I attempted to compile code it wouldn't run because there was no compiler for cross platform programs, It would only compile for windows.

So in breif what I am attempting to do:

  • Build Code on a windows computer
  • Send code to raspberry pi running either a linux distro or windows 10 iot core (I would like to do both)
  • I have visual studio 2013 ultimate and Qt Creator installed right now but I wouldn't object to using a different IDE as long as it can fullfil the task.

If anyone has any ideas on where to turn next I would be very greatful as my search on the interwebs is not being very helpful.

Kind regards and happy coding,

Game Of Drones.

Can the pi run windows 10?

The X86 cheap PCs like it are from LattePanda, they run cherry trail

thanks for the reply @Streetguru
RPi can run windows 10 IoT Core (a trimmed down version of win10 with specific support for gpio headers etc), Don't think i really need anything as powerful as the LattePanda (although I might look into it, so thanks for the heads up).

I was more so asking the question about what software development environment I should use to code and deploy software to both Windows 10 and Linux at the same time (from the same source code).

well notepad++ is seemingly popular, but that's not available on GNU/Linux, just Unix I think

Otherwise here's a list

Also this

If your target is Linux I'd recommend using something like Vagrant to create a development environment (its basically a lightweight Linux [or whatever you fancy] VM that you access through the terminal). This way you can compile your code from your machine and just ship it to the raspberry pi;you can link to whatever Linux-specific lib and try out your code locally, etc. Note that you'll need to compile for ARM to run on the pi and x86 to run on your local machine (been a while since I've done this but IIRC gcc can compile for both on the same machine).

For moving the compiled binary I think using just scp should be good enough.

If you're looking for a cross-platform replacement to Visual Studio, I'd recommend VIM. The learning curve is pretty steep though, and if you find that the case you can always try out Atom instead. Both editors have plenty of plugins allowing you to turn them into - for all practical purposes - IDEs. There's also Visual Studio Code which is made by Microsoft. Unlike their other products though it is open source and works under Linux.

PS. I'm not sure what you're going to try and do with Qt and a raspberry pi. You do realise that Qt is primarily used for GUI applications?

Windows used to be awesome.

There are amazing tools for many flavors of Linux.
Do yourself a favor and start using a better platform, you won't regret it.

Edit: if you didn't catch it he's using Debian in a VM just in case you're afraid to jump out of windows.

1 Like

The thing here isn't actually writing the code, its the compiler since every architecture has its own. Since a Raspberry Pi which I believe is arm and windows is x86 they would have to separate compilers. So you cant compile it for windows and run that compiled version on the Pi.

Whenever I code for my Raspberry Pi(I usually use python causes it's easy and there are a lot of libs for the pi), I use Atom a free text editor devloped by GitHub. Then I simply ssh into the Pi and you can use it like a networked storage server. Then I simply open the file with the Atom editor on my PC modify the code and save it back to the Pi. Then to run it I use the necessary commands from the terminal that I SSHed into. You can do this with c++ the only difference will be you will have to compile it from the command line, which may or may not be a pain. It never hurts to learn more than one language and Python is real easy to pick up.

The raspberry pi doesn't support any other windows then the windows IOT, and pushing code directly from a windows machine onto a raspberry pi can be a hazzle, but mainly the problems are caused by stuff like filepaths, or interacting with the OS in various ways. Most compilers should be available on the raspian/debian platform.
Alot of times the compiler will throw an error explaining which package is missing, or it will be logged somewhere, and if it doesn't there is still googlefu.

@aghost7 @SudoSaibot
Thanks for the tips.

I am very aware that Qt is more of a GUI dev environment, the first project that I want to attempt is a dashboard for home, something that shows my calendar, date, time, pager stream (I'm in the fire brigade so to know the goings on is good), news etc.

That video for programming on Debian looks interesting, I'll need to look at it closer when I get home, is there a way to do GUI that way?

I was also hoping to be able write code in one file and compile for different platforms, just like there dev environments that compile for both iOS and android at the same time I was hoping there might be one for Linux and windows at the same time, something that can also GUI?

Maybe I'm asking too much I'm not sure

The issue isn't the compiler itself, its usually an issue of linking to different libraries depending on the OS (and OS-specific directives). GCC and other compilers have the ability to cross-compile to multiple architectures from the same machine. So that's not going to be an issue.

So what you'd need is a machine with the different header files. You could try and put together the dependencies for the different target operating systems on one machine and compile it from one machine. Issue is that from what I've heard its a pain to do. I'd recommend just using a VM to compile for Linux with a Windows host to do what you want.

He's showing how to setup the libs and tools to compile multiple architectures from one machine. Then using Eclipse on top of that. I hate YouTube videos for tuts but this one is worth the watch.

A quick search gave me this thread, it may be what you're looking for.

The first reply on the thread seems to have some good instructions.