hi all, i have a compled c file ... with output file as a.out ( or any other name ) But this file is executed only on giving # ./(filename) how do i convert it into a executable so that it executes only on giving the filename ( like in Windows as file.exe )
Sagar wrote:
i have a compled c file ... with output file as a.out ( or any
other name ) But this file is executed only on giving # ./(filename) how do i convert it into a executable so that it executes only on giving the filename ( like in Windows as file.exe )
If you don't specify the absolute path to the program executable (like ./a.out), the shell looks for the program in the $PATH Just do "echo $PATH" on your command line and see the output.
So, you can add the current directory (denoted by a dot) to the $PATH --
export PATH=$PATH:.
Now see if it works.
-Manish
hi all, i have a compled c file ... with output file as a.out ( or any other name ) But this file is executed only on giving # ./(filename) how do i convert it into a executable so that it executes only on giving the filename ( like in Windows as file.exe )
Windows has a pathetic way of doing things. And things don't way the same way as they work in GNU/Linux. So before you try out new things, remember to not compare things with how they happen in Windoze.
Now coming to the question you ask, set the path to the directory where your executable lies (you can compile files, so I guess you must be clever enough to do this).
But trust me, for reasons too fine-grained to get in here, it's better to use ./filename syntax for executing things.
Secondly, use the -o switch in gcc/g++ and name your compiled code. And again, compiled code _IS_ executable code. RTFM... chmod, gcc, g++
Regards,
Amol Hatwar.
write this in your .bashrc export PATH=./:$PATH
On Sun, 16 Mar 2003, Sagar wrote:
hi all, i have a compled c file ... with output file as a.out ( or any other name ) But this file is executed only on giving # ./(filename) how do i convert it into a executable so that it executes only on giving the filename ( like in Windows as file.exe )