Hello,
I want to write code on C/C++ on Rpi 3 B+. Is there any reliable IDE to help me on that? Is C/C++ officially supported (as python) by Rpi or I should do "tricks" and result in doing nothing? Of course I will use libraries on C/C++ so I search for a "mainstream" solution...
Any suggestion?
Thank you
Re: Running C/C++ on Raspberry Pi
The Pi runs Raspbian which includes GCC, The GNU Compiler Collection, which compiles C and C++ among other languages. You cannot get more mainstream than GCC.
I try to avoid using IDE's but Microsoft's Visual Studio Code is a greate whiich supports pretty much anything you need from an IDE with extensions. VS Code is open source and runs on Linux, Mac and Windows. I hear it runs on the Pi as well.
I try to avoid using IDE's but Microsoft's Visual Studio Code is a greate whiich supports pretty much anything you need from an IDE with extensions. VS Code is open source and runs on Linux, Mac and Windows. I hear it runs on the Pi as well.
Memory in C++ is a leaky abstraction .
Re: Running C/C++ on Raspberry Pi
The best optimization I can get is with gcc or with Visual Studio?
Thanks
Thanks
Re: Running C/C++ on Raspberry Pi
Your question makes no sense gcc is a compiler, Visual Studio is an IDE.
As as far as I know MicroSoft's compiler MSVCC cannot generate code to run on a Pi using Raspbian.
GCC is a high quality, industry standard C/C++ compiler with very good optimizatiion.
Almost certainly the code you write will have more effect on performance than any difference between compilers.
As as far as I know MicroSoft's compiler MSVCC cannot generate code to run on a Pi using Raspbian.
GCC is a high quality, industry standard C/C++ compiler with very good optimizatiion.
Almost certainly the code you write will have more effect on performance than any difference between compilers.
Memory in C++ is a leaky abstraction .
Re: Running C/C++ on Raspberry Pi
Visual Studio Code is a completely different program from Visual Studio. Visual Studio Code is a cross-platform code editor with plugins that enable IDE-like properties. It doesn't include a compiler for any language. If you write C or C++ with VSCode you need to use GCC or Clang as the compiler.
Re: Running C/C++ on Raspberry Pi
GCC is pre-installed and ready to use.
Clang is an alternative that may be installed if desired.
The optimization done by GCC is class leading.
You can easily examine the assembler code emitted. If you are familiar with assembler, you will likely be very surprised how clever the compiler is.
GCC on the Pi supports many languages:
C, Ada, C++, Go, D, Fortran, Objective C, Objective-C++
GCC also has full support for the latest language standards such as C18 and C++17, which MSVC will never have.
GCC is considered by many to be the gold standard.
In summary, I suggest just use GCC, it will do everything you want and more.
Re: Running C/C++ on Raspberry Pi
Sorry, but objective C/C++ doesn't run only on macbooks??
Re: Running C/C++ on Raspberry Pi
I can't tell if that is that a statement or a question.
But....
Objective-C will run on lots of platforms.
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
Re: Running C/C++ on Raspberry Pi
https://gcc.gnu.org/onlinedocs/gcc/Obje ... tions.html
Note that the poster didn't make any claim about that being a useful option on a Raspberry Pi, only that it was a feature of the GCC compiler.
-
- Posts: 1117
- Joined: Mon Jun 11, 2018 11:22 am
Re: Running C/C++ on Raspberry Pi
a IDE for compilers to C (gcc) and C++ (g++) is the IDE Geany, it's easy, simple, handy, and already pre-installed.nick8967 wrote: ↑Wed Oct 02, 2019 7:19 amHello,
I want to write code on C/C++ on Rpi 3 B+. Is there any reliable IDE to help me on that? Is C/C++ officially supported (as python) by Rpi or I should do "tricks" and result in doing nothing? Of course I will use libraries on C/C++ so I search for a "mainstream" solution...
Any suggestion?
Thank you
Grafic IDEs (GUI-IDEs) like Visual Studio for Windows which work for Linux e.g. are qt creator, gtk, openCV - but for a beginner they are real monsters...
A tutorial for C/C++ using Geany e.g. is this one: http://fractal.math.unr.edu/~ejolson/pi ... dified.pdf
(note that you can build and run the executables directly out of Geany (internally), or instead do that build and run (externally) out of a terminal window).
Re: Running C/C++ on Raspberry Pi
If you are on a Raspberry Pi, It is best to use Code:Blocks for an IDE, and start with a simple console application for the "hello, world!" I can be installed easily using
`sudo apt-get install codeblocks`
Look up GTK+ documentation for making GUI based applications. I use the 2.0 version and downloaded the development libraries with `sudo apt-get install libgtk2.0-dev`. Then added `pkg-config --cflags gtk+-2.0` to the include path, and `pkg-config --libs gtk+-2.0` to the additional libraries.
`sudo apt-get install codeblocks`
Look up GTK+ documentation for making GUI based applications. I use the 2.0 version and downloaded the development libraries with `sudo apt-get install libgtk2.0-dev`. Then added `pkg-config --cflags gtk+-2.0` to the include path, and `pkg-config --libs gtk+-2.0` to the additional libraries.
- HermannSW
- Posts: 3498
- Joined: Fri Jul 22, 2016 9:09 pm
- Location: Eberbach, Germany
- Contact: Website Twitter YouTube
Re: Running C/C++ on Raspberry Pi
My IDE for C/C++ is
- vi (editor, use it since 1990)
- gcc/g++ (compiler)
- gdb (debugger)
- make
- (git)
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/working_with_FPGAs
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/working_with_FPGAs
Re: Running C/C++ on Raspberry Pi
I too was a "basic text editor" VI coder. Waged battles of VI v. Emacs. Scripting v. compiled. Writing macros, and shortcuts, for common operations. Wrote my own make make. The thing is, if I can use a tool to make my life easier, and get me to the finish line quicker, I will use it. GIT is fashionable these days, but I have used Mercurial for several years, so I am used to it.
I was an early adopter of Eclipse, mostly because I was doing a lot of Java stuff back then. I tried running Eclipse on the Pi, and it does work pretty well, but I ran into some library problems with the new version of VM from Oracle, so I switched over to Code:Blocks. I miss some of the mechanisms that Eclipse had, but the small size and speed make up for it.
Running C/C++ on Raspberry Pi, is no different than running it on any Linux based system, so I was providing the quickest and easiest way to produce code, of non-trivial content. True a single file "hello, world!" can be done fully from the command line with a basic editor, but if the program has a high level of complexity, and uses multiple libraries, an IDE helps keep things orderly.
Jack
I was an early adopter of Eclipse, mostly because I was doing a lot of Java stuff back then. I tried running Eclipse on the Pi, and it does work pretty well, but I ran into some library problems with the new version of VM from Oracle, so I switched over to Code:Blocks. I miss some of the mechanisms that Eclipse had, but the small size and speed make up for it.
Running C/C++ on Raspberry Pi, is no different than running it on any Linux based system, so I was providing the quickest and easiest way to produce code, of non-trivial content. True a single file "hello, world!" can be done fully from the command line with a basic editor, but if the program has a high level of complexity, and uses multiple libraries, an IDE helps keep things orderly.
Jack
- DougieLawson
- Posts: 40594
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
- Contact: Website Twitter
Re: Running C/C++ on Raspberry Pi
Same here.
Except, I use cmake because I really don't like Makefiles and cmake takes away that pain.
Any language using left-hand whitespace for syntax is ridiculous
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.
-
- Posts: 1117
- Joined: Mon Jun 11, 2018 11:22 am
Re: Running C/C++ on Raspberry Pi
vi is really a cumbersome crutch from times when the rock'n'roll was invented and which honestly makes me vomite - instead, Geany is a handsome and reasonable editor and IDE.
Re: Running C/C++ on Raspberry Pi
I somehow doubt the honesty of your said reaction to vi. There's nothing wrong with vi (though vim has replaced vi nowadays) although for some strange reason vim-basic is the default installed version (probably more compatible with the original vi). The first thing I do is uninstall that and install the full-fat vim, there's so much of vim missing in vim-basic that I'm sure vim-basic puts newcomers off.dsyleixa123 wrote: ↑Tue Oct 15, 2019 9:12 pmvi is really a cumbersome crutch from times when the rock'n'roll was invented and which honestly makes me vomite - instead, Geany is a handsome and reasonable editor and IDE.
There's gvim as well for when you want a gui rather than console interface. Then again I've been using vim (and emacs) for over 25 years so I'm used to them.
She who travels light — forgot something.
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!
Re: Running C/C++ on Raspberry Pi
dsyleixa123,
Oh for goodness sake. Rock'n'roll arrived in the early 1950s and even before that. Vi did not arrive til the late 1970s
There are so many situations where a "handsome and reasonable editor and IDE" will not work and is of no use what so ever that is very useful to have vi/vim available. It's not a crutch it's a useful, powerful and often essential tool.
If you took the trouble to find out you will discover that vim can run rings around Geany, for example, in terms of functionality and productivity.
Or were you just trolling? I always fall for it...
Oh for goodness sake. Rock'n'roll arrived in the early 1950s and even before that. Vi did not arrive til the late 1970s
There are so many situations where a "handsome and reasonable editor and IDE" will not work and is of no use what so ever that is very useful to have vi/vim available. It's not a crutch it's a useful, powerful and often essential tool.
If you took the trouble to find out you will discover that vim can run rings around Geany, for example, in terms of functionality and productivity.
Or were you just trolling? I always fall for it...
Memory in C++ is a leaky abstraction .
Re: Running C/C++ on Raspberry Pi
Vi used to be the editor you could depend on being available on pretty much any *nix based system - even in recovery mode.
Although recently I worked on systems that had nano instead of vi. That confused me. I installed a minimal vi as soon as I could on them.
Anyone who is likely to do any sysadmin roles at any point should try to learn just basic vi usage.
Although recently I worked on systems that had nano instead of vi. That confused me. I installed a minimal vi as soon as I could on them.
Anyone who is likely to do any sysadmin roles at any point should try to learn just basic vi usage.
Unreadable squiggle
- DougieLawson
- Posts: 40594
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
- Contact: Website Twitter
Re: Running C/C++ on Raspberry Pi
Exactly what I do. I'll see if I can lobby the RPF folks (in the same way I did for ntfs-3g) to get that fixed.
Any language using left-hand whitespace for syntax is ridiculous
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.
Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.
Any requirement to use a crystal ball or mind reading will result in me ignoring your question.
-
- Posts: 1117
- Joined: Mon Jun 11, 2018 11:22 am
Re: Running C/C++ on Raspberry Pi
haha, I had bet that my post would provoke those answers 
But for programming I never use terminal windows and neither ssh, for programming on the Pi one would need a mouse, a comfortable File menu, several tabs, colored code highlighting, symbols and docs side bar, auto-intend, check for brackets/nesting levels, compile-error checking and highlighting feat. a jump to either code line a.s.o., compile+build+run out of the IDE, and that is just what Geany is providing.
OTOH, code::blocks does even much more, and actually that is already far too much for beginners and hobby programmers.

But for programming I never use terminal windows and neither ssh, for programming on the Pi one would need a mouse, a comfortable File menu, several tabs, colored code highlighting, symbols and docs side bar, auto-intend, check for brackets/nesting levels, compile-error checking and highlighting feat. a jump to either code line a.s.o., compile+build+run out of the IDE, and that is just what Geany is providing.
OTOH, code::blocks does even much more, and actually that is already far too much for beginners and hobby programmers.
Re: Running C/C++ on Raspberry Pi
dsyleixa123,
Well done Sir. Excellent troll.
Meanwhile:
As it happens Vim can do all of that.
Damn that nano thing. It turns up everywhere now. Who thought that was good idea?
Well done Sir. Excellent troll.
Meanwhile:
Wow, did you say vim was a crutch? How many crutches do you need to make any progress? It's amazing you can even stand up.For programming on the Pi one would need a mouse, a comfortable File menu, several tabs, colored code highlighting, symbols and docs side bar, auto-intend, check for brackets/nesting levels, compile-error checking and highlighting feat. a jump to either code line a.s.o., compile+build+run out of the IDE,
As it happens Vim can do all of that.
Damn that nano thing. It turns up everywhere now. Who thought that was good idea?
Memory in C++ is a leaky abstraction .
-
- Posts: 1117
- Joined: Mon Jun 11, 2018 11:22 am
Re: Running C/C++ on Raspberry Pi
vi with a mouse and colored code highlighting and compile+run out of the program a.s.o...?
If I type vi in the console it's just an ugly b+w text-box.
(ok, nano is surely even worse, actually not even worth mentioning...)
PS,
and don't forget: this topic is about a beginner to C(++) programming on the Pi who is asking about an IDE.
Even the MagPi C tutorial is using Geany.
If I type vi in the console it's just an ugly b+w text-box.
(ok, nano is surely even worse, actually not even worth mentioning...)
PS,
and don't forget: this topic is about a beginner to C(++) programming on the Pi who is asking about an IDE.
Even the MagPi C tutorial is using Geany.
Re: Running C/C++ on Raspberry Pi
dsyleixa123,
When I type gcc in the console it says:
How useless is that?!
I guess at some point one has to have a clue.
I have to come clean, I do almost all of my editing, for all kind of languages, in Visual Studio Code now a days.
Luckily VSCode is really good at working with files on my headless Pi and remote machines over ssh from my PC/Laptop.
I've tried all kind of other editors and IDEs over the years, hated them all, Eclipse and InteliJ are the worst. VSCode rocks my boat. Thank you Microsoft, all is forgiven.
Odd thing that.If I type vi in the console it's just an ugly b+w text-box.
When I type gcc in the console it says:
Code: Select all
gcc: fatal error: no input files
compilation terminated.
I guess at some point one has to have a clue.
Yes. So why did you mention vi again?..and don't forget: this topic is about a beginner to C(++) programming on the Pi who is asking about an IDE.
I have to come clean, I do almost all of my editing, for all kind of languages, in Visual Studio Code now a days.
Luckily VSCode is really good at working with files on my headless Pi and remote machines over ssh from my PC/Laptop.
I've tried all kind of other editors and IDEs over the years, hated them all, Eclipse and InteliJ are the worst. VSCode rocks my boat. Thank you Microsoft, all is forgiven.
Memory in C++ is a leaky abstraction .