Code::Blocks Forums

User forums => Help => Topic started by: king601 on May 06, 2013, 06:24:27 pm

Title: Help code blocks not launching termial when program is executed [solved]
Post by: king601 on May 06, 2013, 06:24:27 pm
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.
Title: Re: Help code blocks not launching termial when program is executed
Post by: oBFusCATed on May 06, 2013, 08:40:49 pm
Do you have the terminal installed?
Title: Re: Help code blocks not launching termial when program is executed
Post by: BlueHazzard on May 06, 2013, 11:30:42 pm
does the executable file exists?
Title: Re: Help code blocks not launching termial when program is executed
Post by: king601 on May 07, 2013, 02:29:17 am
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.
Title: Re: Help code blocks not launching termial when program is executed
Post by: king601 on May 07, 2013, 02:31:14 am
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
Title: Re: Help code blocks not launching termial when program is executed
Post by: Seronis on May 07, 2013, 05:20:27 am
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?
Title: Re: Help code blocks not launching termial when program is executed
Post by: oBFusCATed on May 07, 2013, 10:15:39 am
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?
Title: Re: Help code blocks not launching termial when program is executed
Post by: Seronis on May 07, 2013, 02:12:31 pm
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

(http://i.imgur.com/W2asLXx.png)
Title: Re: Help code blocks not launching termial when program is executed
Post by: king601 on May 08, 2013, 04:29:18 am
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://i.imgur.com/TLPoduO.png)
http://imgur.com/TLPoduO
Title: Re: Help code blocks not launching termial when program is executed
Post by: oBFusCATed on May 08, 2013, 08:46:12 am
king601: Do you have xterm installed on the system?
Title: Re: Help code blocks not launching termial when program is executed
Post by: osdt on May 08, 2013, 01:57:43 pm
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? ...
Code
xterm -T my\ first\ c\ project ...
should be ...
Code
xterm -T "my first c project" ...
?

- osdt
Title: Re: Help code blocks not launching termial when program is executed
Post by: scarphin on May 08, 2013, 02:26:57 pm
'\'  is the escape character i.e. to insert a space afaik.
Title: Re: Help code blocks not launching termial when program is executed
Post by: osdt on May 08, 2013, 04:25:41 pm
'\'  is the escape character i.e. to insert a space afaik.
Indeed, it works to guard spaces ...
Code
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
Title: Re: Help code blocks not launching termial when program is executed
Post by: king601 on May 08, 2013, 05:21:03 pm
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 ?
Title: Re: Help code blocks not launching termial when program is executed
Post by: king601 on May 08, 2013, 05:30:21 pm
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
Title: Re: Help code blocks not launching termial when program is executed
Post by: oBFusCATed on May 08, 2013, 09:06:21 pm
xfce4-terminal -T $TITLE -x , many thanks
Added in svn...