How do I run a .out file in linux? I compiled with gcc.
How do I run a .out file in linux? I compiled with gcc.
./a.out
Alternatively, if you don't want it to compile to a.out you can use the -o option. Like gcc mytest.c -o test will create an executable named test (which you run of course with ./test)
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
haha I remember wasting loads of time when I tried running a program named test on linux for the first time. But it's one of those things you have to go through to learn that you always use ./ when running executables in the current directory
Thanks. Why is it ./a.out instead of just a.out?
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens
Just writing "program" will try to find the program in all of the directories specified in your path environment variable, which does not contain your current working directory in most cases. This is why you need to use "./" - . means the current directory.
"What's up, Doc?"
"'Up' is a relative concept. It has no intrinsic value."
It's like that so you can run regular commands without programs in the present working directory masking them.