Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: ausairman on July 22, 2011, 09:04:16 am

Title: Can't get Code blocks to "run" code
Post by: ausairman 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  :)
Title: Re: Can't get Code blocks to "run" code
Post by: oBFusCATed on July 22, 2011, 09:07:45 am
Have you tried this with a new simple console hello world project?
Title: Re: Can't get Code blocks to "run" code
Post by: Freem 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.
Title: Re: Can't get Code blocks to "run" code
Post by: Jenna 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.