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?

5

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.

  • 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 Oct 30 '18 at 19:25
  • Google searching for solutions and implementing them doesnt lead anywhere, any clues as to what is going on? – mding5692 Oct 30 '18 at 19:27
1

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.

  • 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 Mar 8 '17 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 Mar 9 '17 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 Mar 9 '17 at 12:03
  • Excuse me, zipzit, but I don't think that vs has compatibility for ARM processors :P – CTECH 9 Apr 4 '17 at 14:59
  • 1
    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 Apr 4 '17 at 21:36
0

I use Code::Blocks 13.2 on RPi, 16.1 on i386. I can't see much difference between the two versions tbh. The editing and compiling is faster on the i386 (quad core Atom).

I find debugging with the gdb is painfully slow on both RPi and i386 and gdb often seems to hang: I tend to keep the Task Manager running so I can kill gdb manually. Finding a place in my code where a breakpoint will stop is hit-and-miss. I often resort to logging to a debug file and running in Release mode.

Must admit I'm tempted to give MS Visual Studio 2017 a try for my next RPi project :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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