Filter Class using Composition

I need some help completing my Homework Please. I am attaching what I have with my compiler errors.
DriverFile.cpp
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#include "Capacitor.h"
#include <conio.h>
#include "Filter.h"
#include <iostream>
#include "Resistor.h"
#include <windows.h>
#include <iomanip>

using namespace std;

void clear_screen(void);

void main(void)
{
 // Local variable for text data entry
 char tempName[16];
 // Local variable for component value data entry
 double tempValue;



 cout << "Instantiate one object of class Filter" << endl << endl;

 cout << "Enter a name for the new filter object:  ";
 cin.getline(tempName,15,'\n');

 Filter filt1;

 // Display filter values
 cout << setiosflags(ios::fixed)
  << setiosflags(ios::right)
  << setiosflags(ios::showpoint)
  << setprecision(3);
 cout << endl << endl;
 cout << "Nominal Filter Frequency =   " << setw(10) << filt1.getFilter() << " Hertz" << endl;
 cout << "Minimum Filter Frequency =   " << setw(10) << filt1.getMaxFilter() << " Hertz" << endl;
 cout << "Maximum Filter Frequency =   " << setw(10) << filt1.getMinFilter() << " Hertz" << endl;
 cout << "Filter Bandwidth Frequency = " << setw(10) << filt1.getFilterTol() << " Hertz" << endl; 

 // Display resistor values
 cout << setiosflags(ios::fixed)
   << setiosflags(ios::right)
   << setiosflags(ios::showpoint)
   << setprecision(3);
 cout << endl << endl;
 cout << "Nominal Resistance Value =   " << setw(10) << filt1.getResistance() << " ohms" << endl;
 cout << "Resistor Tolerance Value =   " << setw(10) << filt1.getResTolerance()*100 << " Percent" << endl;
 cout << "Maximum Resistance Value =   " << setw(10) << filt1.getMaxResistance() << " ohms" << endl;
 cout << "Minimum Resistance Value =   " << setw(10) << filt1.getMinResistance() << " ohms" << endl;
 cout << endl << endl;

 // Display capacitor values
 cout << setiosflags(ios::fixed)
   << setiosflags(ios::showpoint)
   << setiosflags(ios::left)
   << setprecision(3);
 cout << "Nominal Capacitance Value =  " << setw(10) << filt1.getCapacitance() *1000000<< " micro Farads" << endl;
 cout << "Capacitor Tolerance Value =  " << setw(10) << filt1.getCapTolerance()*100 << " Percent" << endl;
 cout << "Maximum Capacitance Value =  " << setw(10) << filt1.getMaxCapacitance() * 1000000 << " micro Farads" << endl;
 cout << "Minimum Capacitance Value =  " << setw(10) << filt1.getMinCapacitance() * 1000000<< " micro Farads" << endl;
 cout << endl << endl;

 //filt1.FilterSave();

 cout << "Enter new nominal resistance value for filter:  ";
 cin >> tempValue;
 filt1.setResistance(tempValue);

 cout << "Enter new resistance tolerance value for filter:  ";
 cin >> tempValue;
 filt1.setResTolerance(tempValue/100.0);

 cout << "Enter new nominal micro Farad capacitance value for filter:  ";
 cin >> tempValue;
 filt1.setCapacitance(tempValue/1000000.0);

 cout << "Enter new capacitance tolerance value for filter:  ";
 cin >> tempValue;
 filt1.setResTolerance(tempValue/100.0);

 // Calculate filter values based on new resistance and capacitance values
 filt1.calculateFilter();

 // Display filter values
 cout << setiosflags(ios::fixed)
  << setiosflags(ios::right)
  << setiosflags(ios::showpoint)
  << setprecision(3);
 cout << endl << endl;
 cout << "Nominal Filter Frequency =   " << setw(10) << filt1.getFilter() << " Hertz" << endl;
 cout << "Minimum Filter Frequency =   " << setw(10) << filt1.getMaxFilter() << " Hertz" << endl;
 cout << "Maximum Filter Frequency =   " << setw(10) << filt1.getMinFilter() << " Hertz" << endl;
 cout << "Filter Bandwidth Frequency = " << setw(10) << filt1.getFilterTol() << " Hertz" << endl; 

 // Display resistor values
 cout << setiosflags(ios::fixed)
   << resetiosflags(ios::left)
   << setiosflags(ios::right)
   << setiosflags(ios::showpoint)
   << setprecision(3);
 cout << endl << endl;
 cout << "Nominal Resistance Value =   " << setw(10) << filt1.getResistance() << " ohms" << endl;
 cout << "Resistor Tolerance Value =   " << setw(10) << filt1.getResTolerance()*100 << " Percent" << endl;
 cout << "Maximum Resistance Value =   " << setw(10) << filt1.getMaxResistance() << " ohms" << endl;
 cout << "Minimum Resistance Value =   " << setw(10) << filt1.getMinResistance() << " ohms" << endl;
 cout << endl << endl;
 
 cout << setiosflags(ios::fixed)
   << setiosflags(ios::showpoint)
   << setiosflags(ios::left)
   << setprecision(3);
 cout << "Nominal Capacitance Value =  " << setw(10) << filt1.getCapacitance() *1000000<< " micro Farads" << endl;
 cout << "Capacitor Tolerance Value =  " << setw(10) << filt1.getCapTolerance()*100 << " Percent" << endl;
 cout << "Maximum Capacitance Value =  " << setw(10) << filt1.getMaxCapacitance() * 1000000 << " micro Farads" << endl;
 cout << "Minimum Capacitance Value =  " << setw(10) << filt1.getMinCapacitance() * 1000000<< " micro Farads" << endl;
 cout << endl << endl;


 filt1.FilterRead();
 //filt1.calculateFilter();

 // Display filter values
 cout << setiosflags(ios::fixed)
  << setiosflags(ios::right)
  << setiosflags(ios::showpoint)
  << setprecision(3);
 cout << endl << endl;
 cout << "Nominal Filter Frequency =   " << setw(10) << filt1.getFilter() << " Hertz" << endl;
 cout << "Minimum Filter Frequency =   " << setw(10) << filt1.getMaxFilter() << " Hertz" << endl;
 cout << "Maximum Filter Frequency =   " << setw(10) << filt1.getMinFilter() << " Hertz" << endl;
 cout << "Filter Bandwidth Frequency = " << setw(10) << filt1.getFilterTol() << " Hertz" << endl; 

 // Display resistor values
 cout << setiosflags(ios::fixed)
   << resetiosflags(ios::left)
   << setiosflags(ios::right)
   << setiosflags(ios::showpoint)
   << setprecision(3);
 cout << endl << endl;
 cout << "Nominal Resistance Value =   " << setw(10) << filt1.getResistance() << " ohms" << endl;
 cout << "Resistor Tolerance Value =   " << setw(10) << filt1.getResTolerance()*100 << " Percent" << endl;
 cout << "Maximum Resistance Value =   " << setw(10) << filt1.getMaxResistance() << " ohms" << endl;
 cout << "Minimum Resistance Value =   " << setw(10) << filt1.getMinResistance() << " ohms" << endl;
 cout << endl << endl;
 
 cout << setiosflags(ios::fixed)
   << setiosflags(ios::showpoint)
   << setiosflags(ios::left)
   << setprecision(3);
 cout << "Nominal Capacitance Value =  " << setw(10) << filt1.getCapacitance() *1000000<< " micro Farads" << endl;
 cout << "Capacitor Tolerance Value =  " << setw(10) << filt1.getCapTolerance()*100 << " Percent" << endl;
 cout << "Maximum Capacitance Value =  " << setw(10) << filt1.getMaxCapacitance() * 1000000 << " micro Farads" << endl;
 cout << "Minimum Capacitance Value =  " << setw(10) << filt1.getMinCapacitance() * 1000000<< " micro Farads" << endl;
 cout << endl << endl;
}


Last edited on
closed account (o3hC5Di1)
Hi there,

Please put some code tags around your code - that makes it a lot more readable and includes line numbers.
Also - I didn't see any compiler errors in there, did you forget them?

All the best,
NwN
Sorry about the code tags.. forgot been busy all day working on this project. I can send the compiler errors in a different forum but the maximum number of words allowed was 9000 and I exceed it so I deleted the compiler errors. I can email you what I have if you can help me.
Please post the errors or tell us where the problem is.
closed account (o3hC5Di1)
@Treyriggins, just create another post containing the compiler errors.

Can't compile it here myself because I don't have your custom header files.

All the best,
NwN
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
57
58
59
60
61
62
63
64
65
66
1>  FilterMain.cpp
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filter.h(34): error C2146: syntax error : missing ';' before identifier 'm_oFiltRes'
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filter.h(34): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filter.h(34): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(31): error C2065: 'Filter' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(31): error C2146: syntax error : missing ';' before identifier 'filt1'
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(31): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(39): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(39): error C2228: left of '.getFilter' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(40): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(40): error C2228: left of '.getMaxFilter' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(41): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(41): error C2228: left of '.getMinFilter' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(42): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(42): error C2228: left of '.getFilterTol' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(50): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(50): error C2228: left of '.getResistance' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(51): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(51): error C2228: left of '.getResTolerance' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(52): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(52): error C2228: left of '.getMaxResistance' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(53): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(53): error C2228: left of '.getMinResistance' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(61): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(61): error C2228: left of '.getCapacitance' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(62): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(62): error C2228: left of '.getCapTolerance' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(63): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(63): error C2228: left of '.getMaxCapacitance' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(64): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(64): error C2228: left of '.getMinCapacitance' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(71): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(71): error C2228: left of '.setResistance' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(75): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(75): error C2228: left of '.setResTolerance' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(79): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(79): error C2228: left of '.setCapacitance' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(83): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(83): error C2228: left of '.setResTolerance' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(86): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(86): error C2228: left of '.calculateFilter' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(94): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(94): error C2228: left of '.getFilter' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(95): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(95): error C2228: left of '.getMaxFilter' must have class/struct/union
1>          type is ''unknown-type''
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(96): error C2065: 'filt1' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(96): error C2228: left of '.getMinFilter' must have class/struct/union



The errors are in other files :D

Can you post the files? Well actually the errors seems self explaining. Semicolons and what not.
I posted the filtermain.cpp file at the beginning of this thread and here is the filter.h file.

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
//Filter.h

#pragma 
#include "Capacitor.h"
#include "Resistor.h"

class Filter
{
	Resistor Resistor;
	Capacitor capacitor;
private:
	
	double cutOffFrequency;
	double maxFrequency;
	double minFrequency;
	string filterType;
public:
	Filter(void);
	~Filter(void);
	 void getResistor();
	 void getCapacitor();
	void getFilterType();
	void calculateFilter();
	double getFilter();
	double getMinFilter();
	double getMaxFilter();
	double getFilterTol();
	double getCapacitance;
	double getCapTolerance;
	double getMaxCapacitance;
	double getMinCapacitance;
	double getResistance;
	double getResTolerance;
	double getMaxResistance;
	double getMinResistance;
	double setResistance;
	double setResTolerance;
	double setCapacitance;
	void writeToFile();
	void FilterRead(string);
};
Last edited on
closed account (o3hC5Di1)
Hi there Lauren,

It seems like These errors are the main cause:

1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filter.h(34): error C2146: syntax error : missing ';' before identifier 'm_oFiltRes'
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filter.h(34): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filter.h(34): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int


They cause the following error, that the class cannot be declared properly, and when it can't be declared properly, you can't use it:

1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filtermain.cpp(31): error C2065: 'Filter' : undeclared identifier


The ones below that are a consequence of that.

Now, the very first error states
syntax error : missing ';' before identifier 'm_oFiltRes'
, but strangely enough I can't see that identifier anywhere in your filter.h file?

Also, you are including capacitor.h and resistor.h in both the main and the filter.h files, this causes unnecessary double inclusions, which eats up memory. Search for "c++ include guards" to get that resolved.

I think if you get to the bottom of that m_oFiltRes identifier, you will have your solution.

If you can't find the problem, perhaps post all of your code files to pastebin.com and give us the links here.

All the best,
NwN
Here is the link to my code in pastebin.com:

http://pastebin.com/FCyr1b9b
closed account (o3hC5Di1)
This doesn't make any sense - m_oFiltRes is not mentioned once in the entire code you posted.

Sorry - I'm out of ideas what may be causing this.
Hopefully one of the experts around here will be able to shed their light on it.

All the best,
NwN
Holy crap, how old is the compiler you use! even if you said 30 years old I wouldn't believe it could compile that ungodly mess.

I've had to fix dozens of errors, correct macros, define functions that are done improperly and altogether missing, and I still can't compile this thing.

these are the 'latest' in a series of horror errors:

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
D:\Programming\C++\Projects\CPP\Resistor\Resistor.cpp||In constructor 'Resistor::Resistor(double, double)':|
D:\Programming\C++\Projects\CPP\Resistor\Resistor.cpp|8|warning: 'Resistor::m_dResValue' should be initialized in the member initialization list|
D:\Programming\C++\Projects\CPP\Resistor\Resistor.cpp|8|warning: 'Resistor::m_dTolerance' should be initialized in the member initialization list|
D:\Programming\C++\Projects\CPP\Resistor\Resistor.cpp|8|warning: 'Resistor::m_dMinRResistance' should be initialized in the member initialization list|
D:\Programming\C++\Projects\CPP\Resistor\Resistor.cpp|8|warning: 'Resistor::m_dMaxResistance' should be initialized in the member initialization list|
D:\Programming\C++\Projects\CPP\Resistor\Resistor.cpp|8|warning: 'Resistor::m_cResistorName' should be initialized in the member initialization list|
D:\Programming\C++\Projects\CPP\Resistor\Filter.h||In constructor 'Filter::Filter()':|
D:\Programming\C++\Projects\CPP\Resistor\Filter.h|8|warning: 'Filter::resistor' should be initialized in the member initialization list|
D:\Programming\C++\Projects\CPP\Resistor\Filter.h|8|warning: 'Filter::capacitor' should be initialized in the member initialization list|
D:\Programming\C++\Projects\CPP\Resistor\Filter.h|8|warning: 'Filter::resistance' should be initialized in the member initialization list|
D:\Programming\C++\Projects\CPP\Resistor\Filter.h|8|warning: 'Filter::resTolerance' should be initialized in the member initialization list|
D:\Programming\C++\Projects\CPP\Resistor\Filter.h|8|warning: 'Filter::capacitance' should be initialized in the member initialization list|
D:\Programming\C++\Projects\CPP\Resistor\Filter.h|8|warning: 'Filter::cutOffFrequency' should be initialized in the member initialization list|
D:\Programming\C++\Projects\CPP\Resistor\Filter.h|8|warning: 'Filter::maxFrequency' should be initialized in the member initialization list|
D:\Programming\C++\Projects\CPP\Resistor\Filter.h|8|warning: 'Filter::minFrequency' should be initialized in the member initialization list|
D:\Programming\C++\Projects\CPP\Resistor\Filter.h|8|warning: 'Filter::filterType' should be initialized in the member initialization list|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp||In function 'int main()':|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp|25|note: synthesized method 'Filter::Filter()' first required here |
obj\Debug\Filter.o:D:\Programming\C++\Projects\CPP\Resistor\Filter.cpp|89|undefined reference to `std::basic_ofstream<char, std::char_traits<char> >::open(std::string const&, std::_Ios_Openmode)'|
obj\Debug\Filter.o:D:\Programming\C++\Projects\CPP\Resistor\Filter.cpp|108|undefined reference to `std::basic_ifstream<char, std::char_traits<char> >::open(std::string const&, std::_Ios_Openmode)'|
obj\Debug\main.o||In function `main':|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp|36|undefined reference to `Filter::getFilterTol()'|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp|44|undefined reference to `Filter::getResistance()'|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp|45|undefined reference to `Filter::getResTolerance()'|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp|46|undefined reference to `Filter::getMaxResistance()'|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp|47|undefined reference to `Filter::getMinResistance()'|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp|55|undefined reference to `Filter::getCapacitance()'|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp|56|undefined reference to `Filter::getCapTolerance()'|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp|57|undefined reference to `Filter::getMaxCapacitance()'|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp|58|undefined reference to `Filter::getMinCapacitance()'|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp|91|undefined reference to `Filter::getFilterTol()'|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp|100|undefined reference to `Filter::getResistance()'|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp|101|undefined reference to `Filter::getResTolerance()'|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp|102|undefined reference to `Filter::getMaxResistance()'|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp|103|undefined reference to `Filter::getMinResistance()'|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp|110|undefined reference to `Filter::getCapacitance()'|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp|111|undefined reference to `Filter::getCapTolerance()'|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp|112|undefined reference to `Filter::getMaxCapacitance()'|
D:\Programming\C++\Projects\CPP\Resistor\main.cpp|113|undefined reference to `Filter::getMinCapacitance()'|
obj\Debug\main.o||In function `Filter':|
D:\Programming\C++\Projects\CPP\Resistor\Filter.h|8|undefined reference to `Resistor::~Resistor()'|
obj\Debug\main.o||In function `~Filter':|
D:\Programming\C++\Projects\CPP\Resistor\Filter.h|8|undefined reference to `Resistor::~Resistor()'|
D:\Programming\C++\Projects\CPP\Resistor\Filter.h|8|undefined reference to `Resistor::~Resistor()'|
||=== Build finished: 23 errors, 14 warnings ===|

this is my best attempting at fixing it, still has some problems.

http://pastebin.com/tz2UcfZ6
Thanks Zephilinox,

This helped a lot. I have only one error. Which is Filter::FilterRead which is found in the filtermain.cpp file "contains no arguments." Error C2260
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
void Filter::FilterRead()
{
    std::ifstream fin;
    fin.open (filename);
 
    if (!fin)
    {
        std::cout << "File do not exist.";
        return;
    }
    else
    {
        std::string line;
  
        while (fin)
            getline (fin, line);
            std::cout << line << std::endl;
        }
    }
 
    fin.close();
}



This is my compiler error and I can't seem to declare 'filename' on line 4. Any suggestions?
Last edited on
What is filename? You haven't declared it as anything, so the compiler has no idea what it is.
I need to declare 'filename' in my header file, right? Or can I declare it before the function here in the cpp file?
Topic archived. No new replies allowed.