News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Help code blocks not launching termial when program is executed [solved]

Started by king601, May 06, 2013, 06:24:27 PM

Previous topic - Next topic

king601

Hello guys,

I have Manjaro Linux installed on my mahcine which is based on Arch Linux with XFCE environment on top of it . I installed code blocks through Arch respiratories   . However , when I write a simple program like hello world in C, it complies successfully but does not launch in terminal to show me" hello world". I just started learning C for my school  , I have code blocks on widnows and it run successfully with MS-Dos, however, I want to do it on linux since I want to learn how to use linux as every uses. Bear in mind that I am still above a little bit on noob level on linux  :) . I tried to change terminal type from Environment setting  but did not work on codeblocks.

oBFusCATed

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

BlueHazzard


king601

Quote from: oBFusCATed on May 06, 2013, 08:40:49 PM
Do you have the terminal installed?
Yes I have terminal installed but I am operating in XFCE environment so I think code blocks is un able to launch terminal for xfce terminal.

king601

Quote from: BlueHazzard on May 06, 2013, 11:30:42 PM
does the executable file exists?
What do you mean by that ?. To have code blocks installed , my distro provides add/remove software . I search for codeblocks and installed it automatically for me like Ubuntu software centre. So no , I do not have the executable files

Seronis

He probably means are you sure the hello world compiled properly. Did you get any warnings/errors? Im using XFCE too, though via xubuntu. I installed CB via apt-get.  As a quick test I just did a new project and chose 'Console Application' and C++. Gave it a name and next'd till i had the default hello world code. Compile and build successfully popped open a console window with no adjustments needed to the project.

Can you verify what -exact- steps you did to make your test program?

oBFusCATed

Quote from: king601 on May 06, 2013, 06:24:27 PM
I tried to change terminal type from Environment setting  but did not work on codeblocks.
What is the current value of the terminal command in the env settings?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Seronis

Quote from: oBFusCATed on May 07, 2013, 10:15:39 AM
What is the current value of the terminal command in the env settings?

I know that wasnt directed at ME. But since im also using XFCE figure id post what mine looks like as reference


king601

Hello guys again . I am providing you with picture of simple program in C  with the compile output, "hello world". It does not matter which type of terminal I running, all of them yields the same thing

http://imgur.com/TLPoduO

oBFusCATed

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

osdt

Looks like the project path and executable name contains spaces. Remove them and it should work (if xterm is installed).

@devs: where do the backslashes come from? ...

xterm -T my\ first\ c\ project ...

should be ...

xterm -T "my first c project" ...

?

- osdt

scarphin

'\'  is the escape character i.e. to insert a space afaik.

osdt

Quote from: scarphin on May 08, 2013, 02:26:57 PM
'\'  is the escape character i.e. to insert a space afaik.
Indeed, it works to guard spaces ...

mkdir "/tmp/aaa bbb"
echo "#/bin/sh\necho Hello World" > "/tmp/aaa bbb/hello world.sh"
chmod +x "/tmp/aaa bbb/hello world.sh"

xterm -T /tmp/aaa\ bbb -e /usr/bin/cb_console_runner /tmp/aaa\ bbb/hello\ world.sh
Process returned 0 (0x0)   execution time : 0.009 s
Press ENTER to continue.

xterm -T "/tmp/aaa bbb" -e /usr/bin/cb_console_runner "/tmp/aaa bbb/hello world.sh"
Process returned 0 (0x0)   execution time : 0.009 s
Press ENTER to continue.

Funny, I've never seen it to be used like this :D

- osdt

king601

Quote from: oBFusCATed on May 08, 2013, 08:46:12 AM
king601: Do you have xterm installed on the system?
No I don't have one. I tried all the options in the environment setting but code blocks does not detect terminal. My system is arch Linux with XFCE installed so I can launch terminal from main menu . What is the difference to have xterm?. How do I install it ?

king601

Update: I was able to xterm from arch repositories and now code blocks works  ;D thank you guys for your help

Update 2: I am now able to run the program in xfce terminal by doing this code :

xfce4-terminal -T $TITLE -x , many thanks