eclipse cdtでコンソールベースの計算機を作成しようとしていますが、構造計算の認識に問題があるようです。
私のヘッダーファイルがあります:
#ifndef __CALC_H__
#define __CALC_H__
#include <iostream>
struct Calc {
Calc();
Calc(const Calc &other);
bool error;
int display;
char oper;
int result;
int memory;
void digit(int digit);
void op(char oper);
void equals();
void memPlus();
void memClear();
void memRecall();
bool isError() const;
void allClear();
};
std::ostream &operator<<(std::ostream &out, const Calc &c);
#endif
と私のソースファイル
#include "calc.h"
void doOperation(Calc& calc){
switch(calc.oper){//ide tells me oper cant be resolved
case '+':
break;
case '-':
break;
case '*':
break;
case '/':
break;
}
}
void Calc(){
}
void Calc(const Calc& other){//ide tells me Calc does not name a type
}
したがって、問題は1.operがCalcのデータメンバーとして認識できないことです。2。Calcをパラメータとして使用すると、eclipseはタイプCalcを見つけることができません。どこで間違ったのですか?前もって感謝します!