I get some error that I never face before, how do i resolve it. Is there some form of wrong declaration that I did .
Thanks for all help!!
At the currency.h file
public:
currencyConverter();
void stringToUpper(string);
My Function in currency.cpp file
void currencyConverter::stringToUpper(string &s)
{
for(unsigned int l = 0; l < s.length(); l++)
{
s[l] = toupper(s[l]);
}
}
Error Message:
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
Question Solved:
Solution is to at .h file
void stringToUpper(string&); instead of void stringToUpper(string);
You forgot
&at the declaration ofstringToUpper.