How do I execute a.out?
Im new to linux, and I compiled a simple program for it with gcc (a hello world of sorts), and it went to a.out -- but I can''t figure out how to run this...
Im running redhat8.0, with XWindow 4.2x
./a.out
In Linux, the current directory isn''t usually in the search path, so you need to specify where the executable is with the ./
In Linux, the current directory isn''t usually in the search path, so you need to specify where the executable is with the ./
type this in your fav. shell
"a.out" and perss enter
or "./a.out" and press enter
ofcourse you need to be in the same dir. as a.out file is
to find it just type "find ~/ -iname "a.out"
"a.out" and perss enter
or "./a.out" and press enter
ofcourse you need to be in the same dir. as a.out file is
to find it just type "find ~/ -iname "a.out"
In the console window, type
God puts an apple tree in the middle of the Garden of Eden and says, do what you like guys, oh, but don''t eat the apple. Surprise surprise, they eat it and he leaps out from behind a bush shouting "Gotcha." It wouldn''t have made any difference if they hadn''t eaten it... because if you''re dealing with somebody who has the sort of mentality which likes leaving hats on the pavement with bricks under them you know perfectly well they won''t give up. They''ll get you in the end. -- Douglas Adams
./a.out
God puts an apple tree in the middle of the Garden of Eden and says, do what you like guys, oh, but don''t eat the apple. Surprise surprise, they eat it and he leaps out from behind a bush shouting "Gotcha." It wouldn''t have made any difference if they hadn''t eaten it... because if you''re dealing with somebody who has the sort of mentality which likes leaving hats on the pavement with bricks under them you know perfectly well they won''t give up. They''ll get you in the end. -- Douglas Adams
I guess that is doing it -- but why would the following program
#include <stdio.h>
int main()
{
printf("look -- Im using printf");
return 0;
}
do nothing?
#include <stdio.h>
int main()
{
printf("look -- Im using printf");
return 0;
}
do nothing?
thry this instead
printf("look -- Im using printf\n");
... you need to print before your buffer is filled up, so just use special char ''\n'' for that, it''s the new line char.
printf("look -- Im using printf\n");
... you need to print before your buffer is filled up, so just use special char ''\n'' for that, it''s the new line char.
quote:Original post by Viro
Wow, look at hte posts above. 4 of them within 32 seconds of each other.
Yeah.
DarkHamster:
Hopefully by now you also know that you can specify the name for your compiler output file using the -o (lowercase! uppercase is for optimization level) option:
gcc hello.c -o hello
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement