![]() |
|
|
|
|
|||||||
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What's The Easiest Route To Creating A Unix Executable File for Terminal? | unimachead | OS X (Apple) | 9 | 04-30-2008 07:02 AM |
| Executable file | tonet | Shell Programming and Scripting | 3 | 01-17-2008 08:03 AM |
| How can i read a non text file in unix - ELF-64 executable object file - IA64 | alexcol | UNIX for Advanced & Expert Users | 4 | 07-20-2007 02:05 PM |
| problem in creating executable for a client program | konas | High Level Programming | 2 | 11-17-2006 10:09 AM |
| Newbie question about difference between executable file and ordinary file | Balaji | UNIX for Dummies Questions & Answers | 1 | 11-29-2000 02:49 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
creating executable for every C file
hello Folks,
once we compile any C code on Linux, we run the code using "./a.out".. but can we have an executable for every program so that we can run the code directly without compiling the code every time. just run the executable and get the output! Thanks! |
| Forum Sponsor | ||
|
|
|
|||
|
You could do. Except that normally non-trival C programs are more than one source file.
You could write a C interpretor, but there is no real demand for them. The advantages you get from using C are mainly because it's a compiled language. I rarely call my programs a.out, it would get far too confusing trying to remember which one did what. |
|
|||
|
I may be missing the point on your question but C is a compiled language.
To run it you have to: (a) compile the C source into object files (b) link the object files with libraries to produce the executable once you have done that you can run the executable as many times as you like, and you can call it whatever name you like. It is also compiled specific to the computer's architecture, so you can't expect 386 code to run natively on an UltraSparc. Similarly it is operating system dependent. |
|
|||
|
I would recommend using "-o" option to specify the name of the executable,
so for example, (a) if you have a makefile that only completed half of it's tasks, you could continue where you left off without wondering what a.out referred to (b) if you are creating a shared library, the library often carries and internal representation of it's name, in ELF terms, the SO_NAME field, if the -soname field is not specified it is derived from the output file name, so the shared library may think it's supposed to be "a.out". (c) in a Makefile, this can be standardised as "-o $@" |
|||
| Google UNIX.COM |
| Tags |
| linux |
| Thread Tools | |
| Display Modes | |
|
|
|
The 50 most popular UNIX and Linux searches.
Google Search Cloud for The UNIX and Linux Forums
|
| 421 service not available, remote server has closed connection ^m automate ftp autosys awk trim bash eval bash for loop boot: cannot open kernel/sparcv9/unix command copy/move folder in unix couldn't set locale correctly curses.h cut command in unix find grep find mtime find null character in a unix file grep multiple lines grep or grep recursive hp-ux ifconfig inaddr_any inappropriate ioctl for device lynx javascript mailx attachment mget mtime perl array length ping port remove first character from string in k shell replace space by comma , perl script rsync ftp scp recursive segmentation fault(coredump) sftp script snoop unix solaris change ip address stale nfs file handle syn_sent tar exclude tar extract to folder test: argument expected unix unix .profile unix forum unix forums unix internals unix interview questions unix mtime unix simulator unix.com while loop within while loop shell script |