I am getting errors that for the life of me I cannot figure out.
Error 1 error C1014: too many include files : depth = 1024 \\acad.dvuadmin.net\sce\homedir\d01631274\documents\visual studio 2010\projects\week2class\week2class\generalfunctions.h 3
2 IntelliSense: #include file "\\acad.dvuadmin.net\sce\homedir\d01631274\documents\visual studio 2010\projects\week2class\week2class\Resistor.h" includes itself \\acad.dvuadmin.net\sce\homedir\d01631274\documents\visual studio 2010\projects\week2class\week2class\generalfunctions.h 3
#include "Resistor.h"
#include <iostream>
#include <iomanip>
#include <string.h>
#include <Windows.h>
usingnamespace std;
//This functions retrieves the nominal resistance value from the user.
double CResistor::getNominal(bool fnDisplay)
{
fnDisplay = true;
if (fnDisplay != false)
{
cout << " The 'getNominal' function has been called" << endl;
}
return nominalRes;
}
//This function retrieves the nominal tolerance from the user and display's
//a test message that states the function has been called if the correct boolean
//value has been set.
double CResistor::getTolerance(bool fnDisplay)
{
fnDisplay = true;
if (fnDisplay != false)
{
cout << " The 'getTolerance()' function has been called" << endl;
}
return nominalTol;
}
//This function retrieves the resistor name from the user.
string Cresistor::getResName(bool fnDisplay
{
fnDisplay = true;
if (fnDisplay != false)
{
cout << " The 'getResName()' function has been called" << endl;
}
return (resistorName);
}
//This function defines the Constructor. The Constructor has 4 defualt parameters that will
//initialize the class member attributes nominalRes, nominalTol and resistorName to a default
//value.
CResistor::CResistor(double R, double T,string rN,bool fnDisplay)
{
fnDisplay = true;
if(fnDisplay != false)
{
cout << "The Constructor is called" << endl;
cout << endl;
if(0.0 < R)
{
nominalRes = R;
}
else
{
nominalRes = 0.0;
}
if(.00 < T)
{
nominalTol = T;
}
else
{
nominalTol = .00;
}
resistorName = rN;
}
//This function will reset the class member attribute "nominalTol"
//to the user defined tolerance value.
void (Resistor::setTolerance ( double Tol ,bool fnDisplay)
{
fnDisplay = true;
if(fnDisplay != false)
{
cout <<"The setTolerance function was called" << endl;
}
nominalTol = Tol;
}
void CResistor::setNominal(double nom,bool fnDisplay)
{
fnDisplay = true;
if(fnDisplay != false)
{
The error seems pretty self-explanatory, Resistor.h includes itself. Whether this is correct or not cannot be said, because you are only showing the cpp file.
I cut and pasted the program back in and now I am getting undeclared identifiers. If I get rid of the Resistor.h file I get to many include in program. I am about ready to scrap the whole thing and start all over. The program is giving me undeclared identifiers everywhere. It is like the programs are not linking.
Resistor.H
#include <iostream>
#include <iomanip>
#include <string.h>
#include <Windows.h>
using namespace std;
class CResistor
{
public:
double getNominal(bool);
double getTolerance(bool);
string getResName(bool);
void setTolerance(double,bool);
void setNominal(double,bool);
CResistor(double,double,string,bool);
CResistor();
// Function displays all data member values of a CResistor object
void DisplayResistance(CResistor& resObj, bool fnDisplay)
{
//Local variables to hold CResistor data copies
double nom, tol, min, max;
nom = resObj.getNominal(fnDisplay);
tol = resObj.getTolerance(fnDisplay);
min = nom * (1.0 - tol);
max = nom * (1.0 + tol);
cout << endl << "Resistor object name is " << resObj.getResName(fnDisplay) << endl;
cout << setiosflags(ios::fixed) << setiosflags(ios::showpoint)
<< setprecision(3);
cout << endl << "Nominal resistance value = " << setw(15) << nom << " ohms ";
cout << endl << "Tolerance = " << setw(15) << tol * 100 << " %";
cout << endl << "Minimum Resistance = " << setw(15) << min << " ohms";
cout << endl << "Maximum Resistance = " << setw(15) << max << " ohms";
cout << endl << endl;
}
// Function allows user to enter new values for CResistor data members
void EnterResistance(CResistor& resObj, bool fnDisplay)
{
//Local variables to hold CResistor data copies
double nom, tol;
string name;
//Local variable for user data entry
int nomEdit = 0;
int tolEdit = 0;
int powerOfTen = 0;
//Valid EIA entry value check boolean
bool validEIA = false;
//Local loop counter
int i = 0;
nom = resObj.getNominal(fnDisplay);
tol = resObj.getTolerance(fnDisplay);
name = resObj.getResName(fnDisplay);
cout << endl << endl;
cout << "Resistor being edited: " << name << endl << endl;