Why do i encounter 'undefined reference to...' in c++?
Example:
void printHello();
int main() {
printHello();
return 0;
}
This error typically means you declared a function but forgot to provide its definition.
Solution:Provide the missing function definition.
void printHello() {
std::cout << "Hello World!" << std::endl;
}
int main() {
printHello();
return 0;
}