I am trying out Geany for the first time. Compile and Build work fine (and indeed the commands are automatically detected), however I have been unable to make Execute do anything at all.
My setup:
- Create a new project
- Save a basic C hello world as hello-world.c
(I am using Kubutuntu 14.04.)
With no extra setup, pressing F9 or clicking Build -> Build correctly builds the executable. However, when I press F5 or click Build -> Execute, a terminal window appears with a $
prompt, and nothing else.
I have tried going to Build -> Set Build Commands and changing the command next to Execute to various things, including "echo hi there", but the result is always the same: a $
prompt, and nothing else.
How do I make F5 do anything?
Update: I have created VMs with clean installs of Ubuntu 14.04 and Kubuntu 14.04. Geany on Ubuntu works as expected, and F5 runs the program. On Kubuntu, I get the same issue I get on my laptop running Kubuntu 14.04. So it seems this is a Kubuntu specific problem.
Solution
In Edit -> Preferences -> Tools, change the Terminal from
x-terminal-emulator -e "/bin/sh %c"
to
x-terminal-emulator -e /bin/sh %c
Explanation
When you press Execute, Geany executes the terminal specified in Edit -> Preferences -> Tools, replacing %c with the Execute command set in Build -> Set Build Commands.
In Ubuntu, the default terminal emulator supports -e
being passed a single parameter in quotes which contains an entire command line, and Execute works as expected. However, the default terminal emulator in Kubuntu is Konsole, which does not support this; it only supports using the rest of arguments after -e
as a command line. When KDE attempted to implement it, this bug was introduced so they reverted the change.
Update
Konsole will support the terminal emulator parameters that Geany uses by default from KDE 4.14.2, so once that's out, this workaround will no longer be needed.
This solution also works in Lubuntu 17.04.
In Geany Edit -> Preferences -> Tools, change the Terminal from x-terminal-emulator -e "/bin/sh %c" to x-terminal-emulator -e /bin/sh %c
来源:https://stackoverflow.com/questions/25574359/how-do-you-make-execute-do-anything-in-geany