How do you make Execute do anything in Geany?

非 Y 不嫁゛ 提交于 2019-12-23 02:16:08

问题


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.


回答1:


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.




回答2:


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!