次のエラーが表示されます。
1> resistor.cpp(7): error C2084: function 'Resistor::Resistor(int,std::string,double,int [])' already has a body
1> resistor.h(25) : see previous definition of '{ctor}'
私のクラス関数のすべてで、レジスター.hには空の実装がありませんが:
Resistor.h:
class Resistor
{
private:
int rIndex;
double resistance; // resistance (in Ohms)
string name; // C++ string holding the label
int endpointNodeIDs[2]; // IDs of nodes it attaches to
public:
Resistor(int rIndex_,string name_,double resistance_,int endpoints_[2]);
}
Resistor.cpp:
Resistor::Resistor(int rIndex_,string name_,double resistance_,int endpoints_[2])
{
if (nodeArray[endpoints_[0]].addResistor(rIndex_) && NodeArray[endpoints_[1]].addResistor(rIndex_))
{
rIndex = rIndex_;
name = name_;
resistance = resistance_;
endpointNodeIDs[0] = endpoints_[0];
endpointNodeIDs[1] = endpoints_[1];
}
return;
}
など、クラス関数ごとに
誰でも私を助けることができますか?
psまた、レジスタークラスのすべての関数に対して、次のエラーも受け取ります(不思議なことに、コンストラクターを除く):
1>rparser.cpp(301): error C2264: 'Resistor::setIndex' : error in function definition or declaration; function not called