Object Error!

Ok, I don't know why I did get this Obj error!

This is the AppCalcularPi.cpp //Were main() is.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

#include "CalcularPi.h"
#include "aplicacion.h"
#include<iostream>
#include<iomanip>

using namespace std;

int main()
{
	srand(static_cast<unsigned>(time(NULL))); 


	CalculaPi dardo; // Objecto dardo es creado.
	Aplicacion rana;

	double corre = 1;

	long veces = 1;



	cout << fixed << setprecision (3) ;

	rana.mensajePrint();

	rana.correPrint(corre);

	while(corre != 0)
	{
		for (int i = 0; i < corre; i++)  
		{
			dardo.aleatoria();





			if( i % veces )
			{
				cout << endl;
				cout << dardo.calculoPi();
			}


		}

		rana.correPrint(corre);

	}

	rana.adiosPrint();


	return 0;
};


ERRORS

1
2
3
4
Error	1	error LNK2019: unresolved external symbol "public: void __thiscall Aplicacion::adiosPrint(void)" (?adiosPrint@Aplicacion@@QAEXXZ) referenced in function _main	AppCalcularPi.obj
Error	2	error LNK2019: unresolved external symbol "public: void __thiscall Aplicacion::correPrint(double)" (?correPrint@Aplicacion@@QAEXN@Z) referenced in function _main	AppCalcularPi.obj
Error	3	error LNK2019: unresolved external symbol "public: void __thiscall Aplicacion::mensajePrint(void)" (?mensajePrint@Aplicacion@@QAEXXZ) referenced in function _main	AppCalcularPi.obj
Error	4	fatal error LNK1120: 3 unresolved externals	JosephCalcularPi v2.exe	1


I know its have to be with the .h and .cpp of the prototypes of the AppCarcularPi.cpp (where main is)

By the way errors ocur when Debuging, when I hit f5 in the VC++.

But why this happens?!
Thanks if someone helps :)

anyone?
Last edited on
It is because the compilier isn't finding the functions...the prototypes go into the .h files, and the definitions go into the .cpp files.

BTW, people don't watch this forum 24/7...so don't expect help instantly.
Yeah that's what I did The AppCalcularPi.cpp prototypes are in the .h and the definitions are in the .cpp, so what's the problem?...



LOL I know, PPL doesn't monitor this site 24/ 7 but I'm out of options, and
besides I'm not rushing anyone...

Thanks for the Response :)
Last edited on
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!
Ok, U R AWESOME! it was error number 2.... -_-'!

I forgot to scope it... lol

I'm such an Idiot! :(

Wow u r an awesome Tutor... I wish a tutor Like u could tutor me in the college I go :( sadly there's no Tutors of Programming Courses. And the teacher doesn't tutor because "HE WANTS MORE MONEY!"

Oh, well Thanks man!
Topic archived. No new replies allowed.