User forums > Help

Hello world didn't work at the same time that it did work

(1/2) > >>

matthewbaynham:
I wrote the very simplest "hello world" program to get use to Code Blocks. In the terminal window it works fine, but in the Code Blocks debugger I get an error it says "failed to execute terminal command".

I've attached a screen shot of the Code Blocks window and you can see the one line of code inside the main, and you can see the error at the bottom of the window in red in the debugger window.

The second screen shot that I've attached is the very same application running in the terminal window.  This is compiled by Code Blocks.

So why is Code Blocks compiling something that doesn't work in Code Blocks and yet the same executable that Code Blocks fails to run will run in a terminal window?

MortenMacFly:

--- Quote from: matthewbaynham on October 23, 2022, 03:00:08 pm ---So why is Code Blocks compiling something that doesn't work in Code Blocks and yet the same executable that Code Blocks fails to run will run in a terminal window?

--- End quote ---
A reason could be that you don't have the terminal (xterm in that case) installed. If so, just change the settings and use a terminal that is available for your platform.

matthewbaynham:
I think you have it the wrong way around.

It worked in the terminal window (I don't know if it's xterm or term but it's a command line).

But it didn't work in Code Blocks, although it was written using Code Block and compiled using Code Blocks, then failed to run in Code Blocks.  Look in the screen shot I posted in the black part of the window there is red writing saying "Failed to execute terminal command".

Why does what Code Blocks compiled work outside of Code Blocks but not in Code Blocks?  It just doesn't make sense.

Commaster:
No, Morten has it the right way around.

Try copying the "Failed to execute terminal command" (Everything inside the ' ') and pasting it in your terminal window.

This will quickly show if you have the xterm app installed (which is the default terminal in Code::Blocks settings, and you can change this, as pointed out by Morten)

matthewbaynham:
OK, now that makes more sense, I didn't have xterm installed.

But simply installed xterm solved that.

Thanks for that.

Navigation

[0] Message Index

[#] Next page

Go to full version