[techtalk] Compiling C program

Samantha Jo Moore SamJoMoore at home.com
Fri Jul 21 15:12:45 EST 2000


Muralidhara N wrote:

>     I am user of linux since from 15 months but i am new to 
> administaration. I installed 6.2 version of RedHat Linux in my 
> system along with X-window. It is working pretty good.
> 
>     My problem is that if compile a c program. It compile the 
> program but it is not executable, that results in a.out not found 
> at /bin/bash. 
> 
>     I did lot of exercise but even though the result was zero. 
> 
>    1. changed the mode of the program to 755.
>    2. make configure at /usr/src/linux a.out binaries
>    3. checked the path also  
>    4. perl program are executable(working well) but not       c
> 
> Please help me to solve this problem. 

When the linker stage (ld) creates the output file (a.out) it writes
into it the compiled code of all the modules specified as well as
copies of the modules from the system libraries which contain the 
system functions that your program uses (printf, etc), if linked
statically, or references to the appropriate shared object libraries
(.so) that contain such modules.  After all the stuff is writte to
the output file (a.out) then the linker chmods it to be executable.
If for any reason a referenced function is not found in either the
static or shared libraries, or in your compiled modules then the 
a.out file will not be executable.  You might want to check your
error messages during the link stage to see if there is anything
you're missing.

Samantha





More information about the Techtalk mailing list