int main(void)
int a;
int count=0;

 printf("%d numbers were greater than 3\n",count);

 return 0;

why have the error of ERROR: variable 'file name' not defined ERROR: command 'file name' not found ERROR: cannot execute program 'file name'

closed as off-topic by garethTheRed, chaos, Faheem Mitha, Eric Renouf, PSkocik Oct 18 '15 at 13:25

  • This question does not appear to be about Unix or Linux within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 5
    Please edit your question to include the commands you are using to compile and run the program. – steeldriver Oct 18 '15 at 11:49

In Unix, the executable programs aren't searched for in the current directory, to avoid security risks due to inadvertently running the wrong program.

You have to do e.g.

cc pgm.c -o pgm

to run your program (./ specifically asks to run the executable in the current directory, it doesn't rely on the shell searching for a program called pgm).

Not the answer you're looking for? Browse other questions tagged or ask your own question.