Ubuntu – How to run C program on 14.04

ccode-blocksgeanyprogramming

I'm trying to run some C programs using Geany and Code::Blocks. After coding them, when I run them, a message is showed in the terminal like this:

In Code::Blocks:

sh: 1: /home/c program files/2: not found. "process returned 127 (0x7F)"

In Geany:

"./geany run script.sh./2: not found.
( program excited with code 127)"

While compiling the program using Code::Blocks, it shows:

/bin/sh: 1: g++ : not found.

I don't know what to do now.

Best Answer

Are you running Code::Blocks and or Geany in Wine? I ask because C program files isn't a usual Linux directory.

First, install g++ Install g++:

sudo apt-get install g++

Next:

  • In Geany Compiling and running goes like this:
    Compile: click this button:enter image description here

  • Build:
    Click this button:enter image description here

I think what is happening in Geany is that you are "compiling" which checks your code for errors, but not building, which creates the output file you are trying to execute.

If Code::Blocks doesn't work after installing g++ Install g++, post back and I'll investigate that.

Related Question