今までにないエラーが発生しました。どうすれば解決できますか。私がした何らかの形の間違った宣言はありますか?
すべての助けをありがとう!
currency.hファイルで
public:
currencyConverter();
void stringToUpper(string);
通貨.cppファイルの私の関数
void currencyConverter::stringToUpper(string &s)
{
for(unsigned int l = 0; l < s.length(); l++)
{
s[l] = toupper(s[l]);
}
}
エラーメッセージ:
CLEAN SUCCESSFUL (total time: 132ms)
g++ -c -g -Wall -I/opt/local/include main.cpp -o main.o
g++ -c -g -Wall -I/opt/local/include currencyConverter.cpp -o currencyConverter.o
currencyConverter.cpp:25:6: error: prototype for ‘void currencyConverter::stringToUpper(std::string&)’ does not match any in class ‘currencyConverter’
currencyConverter.h:25:9: error: candidate is: void currencyConverter::stringToUpper(std::string)
make: *** [currencyConverter.o] Error 1
解決した質問:
解決策は.hファイルにあります
void stringToUpper(string&); void stringToUpper(string);の代わりに