User forums > Using Code::Blocks
Can't get Code blocks to "run" code
(1/1)
ausairman:
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
--- End code ---
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 :)
oBFusCATed:
Have you tried this with a new simple console hello world project?
Freem:
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
--- End quote ---
.
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.
Jenna:
Try this as terminal command:
--- Code: ---gnome-terminal --disable-factory --hide-menubar -t $TITLE -x
--- End code ---
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.
Navigation
[0] Message Index
Go to full version