andrum99
Posts: 545
Joined: Fri Jul 20, 2012 2:41 pm

Problem with Geany - 'execute' command displays blank terminal window

Fri Oct 27, 2017 10:04 pm

I'm trying to use Geany on the Pi to learn C++. When I use the 'execute' command, the terminal window that opens is blank. I've not changed the default execute command - it is still set to "./%e". I have tried this on 2 different Pi's with the same result. Is this is a known problem? How can I fix it?

User avatar
Paeryn
Posts: 2516
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Problem with Geany - 'execute' command displays blank terminal window

Sat Oct 28, 2017 12:36 am

It depends, has your program written anything to stdout or stderr (std::cout or std::cerr)? If it has, did it have a newline ('\n', std::endl) at the end (not usually needed for stderr, but usually is for stdout)? Is your program sat waiting for input or looping doing nothing?

If you wrote something to stdout but never wrote a newline or flushed it then it would still be in a buffer waiting to be displayed, if your program never exits or is waiting for input you won't see the final message the geany prints to let you know the program finished. When your program exits the following should appear in the terminal window that was opened (the exit code could be different if you return non-zero from main or call exit with a non-zero value).

Code: Select all

------------------
(program exited with code: 0)
Press return to continue
She who travels light — forgot something.

User avatar
buja
Posts: 496
Joined: Wed Dec 31, 2014 8:21 am
Location: Netherlands

Re: Problem with Geany - 'execute' command displays blank terminal window

Sat Oct 28, 2017 6:38 am

I think you will find the solution here: viewtopic.php?f=66&t=191818#p1203549

1dot0
Posts: 430
Joined: Mon Nov 28, 2016 12:31 pm

Re: Problem with Geany - 'execute' command displays blank terminal window

Sat Oct 28, 2017 10:31 am

buja wrote:
Sat Oct 28, 2017 6:38 am
I think you will find the solution here: viewtopic.php?f=66&t=191818#p1203549
buja, the link you posted is about Python.

@andrum99:
try what Paeryn implied, perhaps something simple like

printf("here I am");
int c=getchar();

or perhaps
fprintf(stderr, "here I am");

BTW, which are your settings to compile and build?

User avatar
buja
Posts: 496
Joined: Wed Dec 31, 2014 8:21 am
Location: Netherlands

Re: Problem with Geany - 'execute' command displays blank terminal window

Sat Oct 28, 2017 10:37 am

1dot0 wrote:
Sat Oct 28, 2017 10:31 am
buja wrote:
Sat Oct 28, 2017 6:38 am
I think you will find the solution here: viewtopic.php?f=66&t=191818#p1203549
buja, the link you posted is about Python.

No, it's not. While the original poster had this problem with Python, I had the same problem with C after upgrading to Raspbian Stretch. The solution worked.

1dot0
Posts: 430
Joined: Mon Nov 28, 2016 12:31 pm

Re: Problem with Geany - 'execute' command displays blank terminal window

Sat Oct 28, 2017 10:41 am

ok, I see...
your suggested solution was not clearly visible as you just posted a link with mutiple posts, not just the solution.

Nonetheless, as I once tried the standard installation of Stretch with a simple C program and Geany, it worked for me remarkably ( I dropped stretch meanwhile because openVG did not install).

andrum99
Posts: 545
Joined: Fri Jul 20, 2012 2:41 pm

Re: Problem with Geany - 'execute' command displays blank terminal window

Sat Oct 28, 2017 12:25 pm

buja wrote:
Sat Oct 28, 2017 6:38 am
I think you will find the solution here: viewtopic.php?f=66&t=191818#p1203549
That fixed it - many thanks!

dmcallister
Posts: 2
Joined: Sun Apr 07, 2019 3:32 pm

Re: Problem with Geany - 'execute' command displays blank terminal window

Fri May 03, 2019 8:29 pm

Hi
I came across this posts (and replies) because I had the same problem trying to execute C++ programs from Geany on my Pi.
I even followed the instructions in suggested solution in another post: viewtopic.php?f=66&t=191818#p1203549 but that didn't fix. Sometimes clicking the Execute button or following the menu command worked, but on the majority of occasions it didn't.
I tried to find out why it worked on occasions - but the behaviour seemed completely random!

After further internet research I found solution to run the programs from within terminal https://raspberry-projects.com/pi/progr ... g-your-exe

A little annoying, but it works every time,

dmcallister
Posts: 2
Joined: Sun Apr 07, 2019 3:32 pm

Re: Problem with Geany - 'execute' command displays blank terminal window

Tue May 07, 2019 10:42 pm

Clarifying my post from few days ago:

Open a terminal window, and navigate to the folder which holds you C++ programs and associated exes are stored
type ./programname (the "./" indicates in this folder)

If you are not in the relevant directory type (full path)/programname

Return to “C/C++”