Author Topic: Can't get Code blocks to "run" code  (Read 7768 times)

Offline ausairman

  • Multiple posting newcomer
  • *
  • Posts: 12
Can't get Code blocks to "run" code
« on: July 22, 2011, 09:04:16 am »
So I have this program in C++ that runs fine in ubuntu once compiled. It compiles without errors in Code blocks and runs in Debug mode straight out of the box (I'm using GNU GCC compiler). In my environment settings I have the following:

Code
Shell to run commands in: /bin/sh -c
Terminal to launch console programs: gnome-terminal -t $TITLE -x

When I hit "debug" the program runs as expected, although it does give me that pesky "Failed to set controlling terminal" error that I can't fix but get get told off for asking about here. So when I just hit "run" or "compile and run" it compiles fine but doesn't launch in the terminal (like it does when I hit debug).

Running the compiled program in the terminal manually (outside of code blocks) works fine.

This started happening recently but for the life of me I can't think of any settings that I have changed (I don't usually touch the environment settings) although I did do a bunch of updates recently, so that might have something to do with it. My Code::blocks version is 10.05

Thanks in advance for the help  :)
« Last Edit: July 22, 2011, 09:10:07 am by ausairman »
Ubuntu 11.04 (64-bit), optiplex 990 i7

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Can't get Code blocks to "run" code
« Reply #1 on: July 22, 2011, 09:07:45 am »
Have you tried this with a new simple console hello world project?
(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 Freem

  • Almost regular
  • **
  • Posts: 218
Re: Can't get Code blocks to "run" code
« Reply #2 on: July 22, 2011, 10:02:41 am »
Maybe I don't understand correctly what do you mean, I'm not sure about the
Quote
(I don't usually touch the environment settings) although I did do a bunch of updates recently
.
Do you mean that you update the config of C::B, the config of your project (if yes, only one target -debug | release- or all?) or the source of your project?

If it's about the code, then sometimes I have problem close to yours.
In those cases, I clean the project in all it's targets, then rebuild.
When after that  there still is a problem, the compiler/linker output (if you have enabled the full log) give some clues to find what is it.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Can't get Code blocks to "run" code
« Reply #3 on: July 22, 2011, 10:28:23 am »
Try this as terminal command:
Code
gnome-terminal --disable-factory --hide-menubar -t $TITLE -x

At least the --disable-factory parameter should be used in my opinion, otherwise gnome-terminal tries to reuse an alrady open terminal, that might lead to problems.

If it still does not work, try the exact command (copied from "Build log") used by C::B to launch the application from inside a terminal to probably get meaningful error-messages.