Author Topic: Help code blocks not launching termial when program is executed [solved]  (Read 22875 times)

Offline king601

  • Single posting newcomer
  • *
  • Posts: 7
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.
« Last Edit: May 08, 2013, 05:30:53 pm by king601 »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Help code blocks not launching termial when program is executed
« Reply #1 on: May 06, 2013, 08:40:49 pm »
Do you have the terminal installed?
(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!]

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Help code blocks not launching termial when program is executed
« Reply #2 on: May 06, 2013, 11:30:42 pm »
does the executable file exists?

Offline king601

  • Single posting newcomer
  • *
  • Posts: 7
Re: Help code blocks not launching termial when program is executed
« Reply #3 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.

Offline king601

  • Single posting newcomer
  • *
  • Posts: 7
Re: Help code blocks not launching termial when program is executed
« Reply #4 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

Offline Seronis

  • Almost regular
  • **
  • Posts: 197
Re: Help code blocks not launching termial when program is executed
« Reply #5 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?
« Last Edit: May 07, 2013, 05:24:27 am by Seronis »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Help code blocks not launching termial when program is executed
« Reply #6 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?
(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!]

Offline Seronis

  • Almost regular
  • **
  • Posts: 197
Re: Help code blocks not launching termial when program is executed
« Reply #7 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


Offline king601

  • Single posting newcomer
  • *
  • Posts: 7
Re: Help code blocks not launching termial when program is executed
« Reply #8 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://imgur.com/TLPoduO

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Help code blocks not launching termial when program is executed
« Reply #9 on: May 08, 2013, 08:46:12 am »
king601: Do you have xterm installed on the system?
(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!]

Offline osdt

  • Multiple posting newcomer
  • *
  • Posts: 63
Re: Help code blocks not launching termial when program is executed
« Reply #10 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

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Help code blocks not launching termial when program is executed
« Reply #11 on: May 08, 2013, 02:26:57 pm »
'\'  is the escape character i.e. to insert a space afaik.

Offline osdt

  • Multiple posting newcomer
  • *
  • Posts: 63
Re: Help code blocks not launching termial when program is executed
« Reply #12 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
« Last Edit: May 08, 2013, 04:30:12 pm by osdt »

Offline king601

  • Single posting newcomer
  • *
  • Posts: 7
Re: Help code blocks not launching termial when program is executed
« Reply #13 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 ?

Offline king601

  • Single posting newcomer
  • *
  • Posts: 7
Re: Help code blocks not launching termial when program is executed
« Reply #14 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
« Last Edit: May 08, 2013, 06:16:27 pm by king601 »