. Advertisement .
..3..
. Advertisement .
..4..
Hey, geys! I’m back here. I am facing with the error: ”unresolved external symbol c++” and I want to ask for your help. Let’s consider the following C++ program which I run:
#include <iostream>
int func1();
int main()
{
func1();
}
/tmp/cc3qLnFB.o: In function 'main':
main.cpp: (.text+0×5): undefined reference to 'func1()'
collect2: error: ld returned 1 exist status
Error: undefined reference/unresolved external symbol errors in C++
The cause:
This error happens because you are missing the definition for the object. Perhaps you forgot it.
Solution:
To fix this error, you need to give the definition of the function func1 for the program as below:
Output:
If you do this way, your problem will be solved.