Bird
0
0

Identify the error in this command sequence:

medium📝 Debug Q6 of 15
C - Basics and Execution Environment
Identify the error in this command sequence:
gcc -c file.c -o file
gcc file.o -o program
AMissing linking command
Bgcc cannot compile with -c flag
COutput file in first command should be file.o, not file
DSecond command should use file, not file.o
Step-by-Step Solution
Solution:
  1. Step 1: Check first command output

    'gcc -c file.c -o file' creates an output named 'file' but should be 'file.o' for object file.
  2. Step 2: Understand linking command

    Second command uses 'file.o' which does not exist due to wrong output name.
  3. Final Answer:

    Output file in first command should be file.o, not file -> Option C
  4. Quick Check:

    Object file must have .o extension [OK]
Quick Trick: Use .o extension for object files with -c [OK]
Common Mistakes:
  • Naming object file without .o extension
  • Confusing compile and link commands
  • Assuming gcc auto-corrects output names

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes