C++

Compilation & Linking

11 question(s)

What is the difference between compile-time and link-time errors?

Beginner
Compile-time errors occur while compiling a single translation unit—syntax mistakes, type errors, undeclared names—and reference a file and line. Link-time errors occur when combining object files—unresolved/duplicate symbols—and reference symbol names, not source lines. Recognizing which stage failed guides the fix (code vs build/link configuration).
Real-world example A typo is a compile error at a line; a missing library is a link error naming an unresolved symbol.

Common follow-ups: Which stage reports unresolved symbols? | Which references a line number?

Compilation & Linking Preprocessor & Macros Compilation & Linking