Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
1)
gcc -c file.c -o file.o


2)
gcc file.c -o file 


please if u gonna to answer the question ,try to give an simple answer as much as possible!

What I have tried:

......................................................
Posted
Updated 24-Apr-21 21:20pm
v2
Comments
Richard MacCutchan 25-Apr-21 3:36am    
Read the gcc documentation where all the options are explained.

-c Compile or assemble the source files, but do not link. The linking stage simply is not done. The ultimate output is in the form of an object file for each source file.

By default, the object file name for a source file is made by replacing the suffix '.c', '.i', '.s', etc., with '.o'.

Unrecognized input files, not requiring compilation or assembly, are ignored.
 
Share this answer
 
v2
Comments
CPallini 25-Apr-21 3:35am    
5.
Command (1) compiles the .c file to a .o (object) file, then stops.

Command (2) compiles the .c file to an object file, then links the object file with the C standard library to produce an executable file named file.

Both commands drop their output in the current directory.
 
Share this answer
 
Comments
CPallini 25-Apr-21 3:35am    
5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900