Back to questions
JuniorTheoryCommon
If this file is the whole program, which build step reports an error?
int twice(int x);
int main() {
return twice(2);
}Linking: twice has no definition anywhere
- Expecting a compiler error: the declaration is enough to compile the call; only the linker looks for the body of
twice. - Expecting
0from a function with no body: there is nothing to run, so the program cannot be built at all.
- What does the linker report when
twiceis defined in two different.cppfiles? - How do the tools
nmandc++filthelp you find which object file lacks a symbol?