Results 1 to 9 of 9

Thread: Running Code::Blocks programs with gnome terminal

  1. #1
    Join Date
    Sep 2009
    Location
    U.S. Arizona
    Beans
    73
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Running Code::Blocks programs with gnome terminal

    It seems that Code::Blocks uses xterm as it's default terminal when running programs. I was wondering what command you would use to run gnome-terminal instead. I tried simply replacing 'xterm' with 'gnome-terminal', but, not surprisingly, it didn't work. I am running Ubuntu 10.04, if that makes any difference.

  2. #2
    Join Date
    Jun 2006
    Beans
    152

    Re: Running Code::Blocks programs with gnome terminal

    Greetings,
    Be careful with these steps; they are safe, but be careful.
    1) sudo su -
    changes your authority into root... enter your password
    2) cd /usr/bin
    changes directory where xterm and gnome-terminal live
    3) mv xterm xterm~
    change the name of the xterm program without deleting it...
    the ~ character is the tilde in the upper left hand corner of
    your keyboard
    4) ln -sf /usr/bin/gnome-terminal xterm
    creates a symbolic link (xterm) to gnome-terminal
    5) exit
    exits root

    Now enter xterm in your command terminal... it will open gnome-terminal instead of xterm.
    Symbolic links are a powerful tool, so be careful. Also, notice that
    since this is done in /usr/bin it is in effect for the whole system.
    When code::blocks calls xterm... it will pull up gnome-terminal instead.
    code::blocks ide may be looking expecting a certain shell?? I don't know. Try it an see.

    regards,
    Kind regards,
    M Harris

  3. #3
    Join Date
    Sep 2009
    Location
    U.S. Arizona
    Beans
    73
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Running Code::Blocks programs with gnome terminal

    It didn't work. This does the same thing as changing 'xterm' to 'gnome-terminal' in the code::blocks settings. The reason this doesn't work is because there are certain flags that must be run, and the ones you use for xterm aren't compatible with gnome-terminal. A friend of mine actually figured out what I needed to do, just change the command from
    Code:
    xterm -T $TITLE -e
    to
    Code:
    gnome-terminal $TITLE -x
    Thanks for the info, anyway!

  4. #4
    Join Date
    Sep 2009
    Location
    California U.S.A.
    Beans
    398

    Re: Running Code::Blocks programs with gnome terminal

    Quote Originally Posted by Eragon0605 View Post
    It didn't work. This does the same thing as changing 'xterm' to 'gnome-terminal' in the code::blocks settings. The reason this doesn't work is because there are certain flags that must be run, and the ones you use for xterm aren't compatible with gnome-terminal. A friend of mine actually figured out what I needed to do, just change the command from
    Code:
    xterm -T $TITLE -e
    to
    Code:
    gnome-terminal $TITLE -x
    Thanks for the info, anyway!
    I know this is old but if you ever come back across this thank you very much.

  5. #5
    Join Date
    Jun 2007
    Location
    Israel
    Beans
    40
    Distro
    Ubuntu

    Re: Running Code::Blocks programs with gnome terminal

    there's one more problem when using the gnome-terminal as the console for code::blocks.
    the gnome-terminal always returns the code 255 and not the code of the program you are running.

    just anyone know how to solve this? although it's not such a big deal since the return value of the program is shown in the gnome-terminal when the program terminates.

  6. #6
    Join Date
    Dec 2010
    Beans
    2

    Re: Running Code::Blocks programs with gnome terminal

    Quote Originally Posted by lousygarua View Post
    there's one more problem when using the gnome-terminal as the console for code::blocks.
    the gnome-terminal always returns the code 255 and not the code of the program you are running.

    just anyone know how to solve this? although it's not such a big deal since the return value of the program is shown in the gnome-terminal when the program terminates.
    I have this annoying problem too, and I've googled so much but nothing useful found.

  7. #7
    Join Date
    Dec 2010
    Beans
    2

    Re: Running Code::Blocks programs with gnome terminal

    I've found something interesting: if I open the gnome-terminal before executing the program in codeblocks, it will not show the red line any more. But once I close the gnome-terminal and execute the program again, the annoying red line comes back at once! Is there anything different here?

  8. #8
    Join Date
    Dec 2010
    Location
    Turku, Finland
    Beans
    1
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Running Code::Blocks programs with gnome terminal

    I found a solution!

    Here's the command I use:
    Code:
    gnome-terminal --disable-factory -t $TITLE -x
    The "--disable-factory" argument runs gnome-terminal in it's own process, apart from other gnome-terminal processes you have running. Without it gnome-terminal will return 255 upon exit, unless you have another gnome-terminal already open.

    This is still only a partial solution, since gnome-terminal will return 0 to Code::Blocks, regardless of what your program returns... If anyone has a solution to this problem, please let us know.

  9. #9
    Join Date
    Oct 2011
    Beans
    2

    Re: Running Code::Blocks programs with gnome terminal

    Thank you very much "Humpparitari".
    I was looking for this so long.
    Thank you once again.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •