I did tutoring for the very beginning level students at my college for a while and a lot of them would look at linker errors and just breakdown immediately. Because there is no line number and they aren't as legible they wouldn't even give them a fair look.
So, let's do a quick decipher of this error:
Error 1 error LNK2019: unresolved external symbol "public: void __thiscall Aplicacion::adiosPrint(void)" (?adiosPrint@Aplicacion@@QAEXXZ) referenced in function _main AppCalcularPi.obj
You can think of every identifier as a symbol. I believe that's correct and although there's probably much more to it than that, this understanding is sufficient to figure out this error. When it says unresolved external symbol, that means that some function in your code is trying to figure out where another symbol is and is failing.
The next part is helpful:
"public:
This tells you that the identifier is part of a class because you have the member access modifier of the class right there. So you know that whatever class this is in, the compiler sees it as public.
The next part is
void
, which is the return type of the function.
__thiscall
has to do with the
this
pointer used within classes.
Aplicacion::
shows you that this resides in the scope of
Aplicacion
adiosPrint(void)
gives you the name and parameter types for the function in question. This one is called adiosPrint and takes no arguments.
I believe the next part is the actual symbol, which you can just skip over.
The last part is
referenced in function _main
. This tells you what function tried to use the function that can't be found.
So this error is saying that the implementation of class function
void adiosPrint()
in the public section of class
Aplicacion
cannot be found by function
_main
.
There are a multiple ways to cause this error, but here are the top three that I've seen:
1) Forgetting to implement it. Oops!
2) Forgetting to add the scope to the function.
Example:
1 2 3 4 5 6 7 8 9 10 11 12
|
// Aplicacion.cpp
#include "Aplicacion.h"
void adiosPrint()
{
// Oops!
}
void Aplicacion::adiosPrint()
{
// Fixed!
}
|
3) Not including the right header file in the source code file. For instance, forgetting
#include "Aplicacion.h"
in Aplicacion.cpp.
I hope that helps!