I'm currently learning to become a programmer and while I was learning I came across a bit of a problem. This program doesn't run and gives me an error
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Why is this and how do I fix it and prevent it from happening again?
#include <iostream>
using namespace std;
void Fav();
int main()
{
Fav();
return 0;
}
void Fav(int x)
{
cout<<"Troy's Favorite Number is \n"<<x;
}
The declared function and defined function are different. They are therefore different functions, the former of which is never defined, even though it is called in
main
You need to change the signature of the declared function to matche the declared and called function