problem with +overloading

so.. i have a 3 files..
fractalDriver.cpp
complexType.cpp
complexType.h

i am getting a crazy error that i have no idea what it is.. but i know where it is caused..

here is the code for my three files.
fractalDriver.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "complexType.h"

int main(void)
{
	ComplexType c1,
				c2,
				c3;

	c3 = c1 + c2;

	cout<<c3.realPart<<","<<c3.fakePart<<endl;

	return 0;
}

complexType.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "complexType.h"

ComplexType::ComplexType()
{
	realPart = 1.2;
	fakePart = 2.4;
}

ComplexType::~ComplexType()
{
	realPart = 0;
	fakePart = 0;
}

ComplexType ComplexType::operator +(ComplexType c)
{
	ComplexType temp;
	temp.realPart = realPart + c.realPart;
	temp.fakePart = fakePart + c.fakePart;
	return (temp);
}

complexType.h
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
/*
    Programmer: Anthony Petecca
    Class: CSCI 330 Fall2009
    10-15-09
    Assignment 3
    Narrative: This is the Complex Class header
		file
*/

#ifndef _COMPLEX
#define _COMPLEX

#include <iostream>
#include <cmath>
#include <cstddef>

using namespace std;

class ComplexType
{
public:

	ComplexType();
	~ComplexType();
	ComplexType(const ComplexType& c);
	ComplexType operator +(ComplexType c);

	double realPart;
	double fakePart;

private:

};

#endif  


so.. the error i am getting is "1>ComplexType.obj : error LNK2019: unresolved external symbol "public: __thiscall ComplexType::ComplexType(class ComplexType const &)" (??0ComplexType@@QAE@ABV0@@Z) referenced in function "public: class ComplexType __thiscall ComplexType::operator+(class ComplexType)" (??HComplexType@@QAE?AV0@V0@@Z)"

if i take out the line that says ComplexType temp;
under the operator+ function.. this error disappears... any ideas??
Last edited on
You don't ever define this:

ComplexType(const ComplexType& c);
wow. that would completely make sense lol... thanks -_-... *sigh*
Topic archived. No new replies allowed.