PDA

View Full Version : How to run a simple C program at anjuta?



yuval2111
November 12th, 2007, 11:50 PM
I am a new user of ubuntu and anjuta.
i worte a simple program at C that prints the word "hello":

#include <stdio.h>
int main(){
printf("hello");
return 0;
}

i run at the shell the command "gcc -Wall test.c -o 1"
and it's compile it fine, but when i wrote the command "1" it wrote to me "bash: 1: command not found". what is the problem? when i do it at the university computers it's run fine.
thanx.

Kevin
November 13th, 2007, 07:46 AM
If you're in the directory where the "1" binary is, then you need to run "./1" at the terminal.

This goes for any executable. Typing the name will always look in /usr/bin, you need to specify ./--name-- to run a file in the current directory.

yuval2111
November 13th, 2007, 09:23 AM
thanx, now it works.

elthumb
November 13th, 2007, 04:46 PM
you can run it without return 0
just
#include <stdio.h>
main()
{
printf("elthumb was here...\n");
}
:guitar: