
In the first case, you declare a function, but don't define it. It compiles properly, but doesn't link because there is no definition for f. Hence the linker error.
선언만 하고 정의는 하지 않았다. 컴파일은 하지만 링킹은 할 수 없다.
In the second case, you attempt to call an undeclared symbol. The compiler doesn't know what f is, so it issues an error. It's a different problem from a different stage of the compilation process, so the message is different.
In the third case, you have a well-defined program (except that main fails to return a value). f is both declared and defined. The program should compile, link, and execute properly.
'undefined reference' with 'not declared'
this is a simple problem in c compiling and linking. But I want to discuss the principle of compiler and linker. void f(); int main() { f(); } this code receive error message "undefined refer...
stackoverflow.com
'IT > Basic' 카테고리의 다른 글
[Basic] Call by value, Call by reference 차이 (0) | 2023.02.28 |
---|---|
[Basic] 런타임과 컴파일타임 차이 (0) | 2021.12.03 |
비트연산 (0) | 2021.05.12 |
Fixed Point Precision(고정 소수점) 과 Floating Point Precision(부동 소수점) (0) | 2021.04.14 |
[Basic] cpu, core, processor 3 (0) | 2021.03.29 |