Core Electronics Forum

Old C++ programmer stumbling over Raspian

The simplest way to program in C++ on Raspberry Pi seem to me to start in Geany with the ‘Hello World’ example, which successfully gave a console output. But I wanted to create a GUI, so I read C_GUI_Programming from RPi Bookshelf and, following the steps, ran:

sudo apt-get install libgtk2.0-dev at the RPi terminal, then
pkg-config --cflags --libs gtk±2.0.

These both reported some failures, but I tried adding to my source file anyway the line:
#include <gtk/gtk.h>, but Geany couldn’t find this file.

Given my inexperience with Linux generally, I thought the Eclipse C++ IDE might with its polished user interface ‘hold my hand’ through the process, but compiling and running a similar ‘Hello World’ example produced about 30 syntax errors in a makefile. I didn’t even enter any code.

Could anyone suggest any reason I shouldn’t put the Raspberry Pi project on ‘hold’ and get back to building my electric vehicle? After all I’m 60 and wasting another 10 years might not be advisable!

Hi Michael

Sorry you’re having trouble with this! As someone who’s programmed in C++ before I understand how finicky it can be sometimes

Just to confirm, have you added that pkg-config command as LIBS and CFLAGS in your makefile?

Best of luck,

1 Like

I’m afraid you may be overestimating my knowledge level. I’ve heard of make files, but in C++ visual studio v5 (20 years ago), the compiler and linker didn’t require editing a makefile. Also I don’t seem to be able to find the makefile or generally navigate directories, even if I knew the make syntax.
Ironically it may be easier to program in assembly, something I’ve done before. I’m about to see if you have a ‘Programming Rasp. in Assembly’ book. Thanks for trying to help!

Hi Michael,

I was going to give a more in-depth description of what I suggested, but I assumed from your strong knowledge elsewhere that it might’ve been too verbose.

I’ll try and find the article/forum post that led me to suggest that and get back to you