3

I would like to be able to code in C++ on my Raspberry Pi. I know that you can edit, run, and compile with only the command line, but I would like a more familiar IDE, such as Visual Basic or CodeBlocks. Are there any I could use?

3

3 Answers 3

6

I was going to just add a comment but did not have enough reputation. I use code:blocks (currently version 13.12 in the repository) for C++ development which can be installed via the terminal using:

    $ sudo apt-get update
    $ sudo apt-get install codeblocks

Then run from the command line with $ codeblocks or from the menu Start > Programming > code::blocks. This has been tested on Raspberry PI models A, B, 2B, 3B using Raspbian Jessie.

2
  • Facing an error when downloading codeblocks this way with this error message appearing on my terminal ==> The following packages have unmet dependencies: codeblocks : Depends: codeblocks-common (= 16.01+dfsg-2) but it is not going to be installed Recommends: xterm
    – mding5692
    Commented Oct 30, 2018 at 19:25
  • Google searching for solutions and implementing them doesnt lead anywhere, any clues as to what is going on?
    – mding5692
    Commented Oct 30, 2018 at 19:27
2

If you are using windows, I'd recommend using Visual Studio. I see that Visual Studio 2017 is now out, and supports both Windows and Mac operating systems. The number one reason I'd recommend this, is there is a Visual Studio Marketplace tool available "Visual C++ for Linux Development" that is pretty amazing for anyone pushing code to remote devices. You write code on your desktop/laptop in Visual Studio (VS).

VS pushes code to your remote device (raspberry pi) for you. You don't have to SSH login to the PI. You don't have to copy code from one place to another. This makes it much easier to manage your project, keep track of updates, ete...

More importantly, that tool includes GDB (Gnu Debugging) which enables you to step debug content on your Raspberry Pi, directly from Visual Studio. If you've got content based on GPIO inputs, you can see exactly what's going on real time.

Here is friendly introduction for using Visual Studio with the Orange/Raspberry Pi. that shows the use of the extra "Visual C++ for Linux Development" tool, including some sample code.

Note: I've been using Microsoft Visual Studio 2015 Community Edition (which is free) up until now. Its not clear on the cost of Visual Studio 2017 (if any)

Edit: It turns out other Integrated Development Environments (IDE) also support GDB debugging. Here's a link describing the process for JetBrain's cLion's IDE. The JetBrain software is way cool, but obviously not free.

Edit #2: Scratch Visual Studio for Mac. That seems to work only for Android/iOS apps and .net. Seems to be no go on C/C++, Python, Node.js ... there is no extension manager option, unlike normal Visual Studio. Sigh.

6
  • 1
    It seems that the OP wants to code on their Pi, locally. Since you seem to be mentioning visual studio, does VS Code support ARM?
    – lights0123
    Commented Mar 8, 2017 at 21:01
  • VS Code (not sure what that is... Is that the new lite version, sort of like using Atom.io? ) I've been using Visual Studio COMMUNITY Edition. It's free, works great with Arm processors. Armbian Linux (Debian) is still Linux. Check out this link...
    – zipzit
    Commented Mar 9, 2017 at 5:26
  • VS Code is a mini-IDE, so it has built-in debugging and running. Atom (or at least me looking around for 5 minutes in it) doesn't do that. VS Code is designed so that the whole application runs on the computer itself, instead of writing code on another computer. It doesn't have builds for ARM, but one person shows how to compile it on a Pi.
    – lights0123
    Commented Mar 9, 2017 at 12:03
  • Excuse me, zipzit, but I don't think that vs has compatibility for ARM processors :P Commented Apr 4, 2017 at 14:59
  • 2
    Er, yes but. Visual Studio works wonderful as a complete integrated development environment (IDE) for raspberry pi, working from a desktop computer and pushing to Raspberry Pi. You can debug, keep copy of code on desktop, etc... No, it does NOT work on the PI itself. Am I the only person who considers raspberry pi software content 'temporary'? (easily wiped, easily replaced...) I always want Pi content backed up somewhere, and with that assumption, I can't imagine a strong reason to use the pi as a coding platform (although you could argue Git push to a repository somewhere would work...)
    – zipzit
    Commented Apr 4, 2017 at 21:36
0

I use Code::Blocks (http://www.codeblocks.org/home) with wxWidgets (http://wxwidgets.org/) on RPi and i386. Since CodeBlocks 17.12 I have not had many problems with it.

Both CodeBlocks and wxWidgets can be installed on your RPi from the command line or graphical package manager. I prefer Synaptic as a graphical package manager over the one that comes with Raspberry Pi OS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.