I am trying to access one header file in multiple C++ files. The header file is defined as follows:
#ifndef UTILS
#define UTILS
void toUpper(string &str) {
for(unsigned int i=0; i<str.length(); i++) {
str.at(i) = toupper(str.at(i));
}
}
void toLower(string &str) {
for(unsigned int i=0; i<str.length(); i++) {
str.at(i) = tolower(str.at(i));
}
}
#endif // UTILS
When I compile the code I get the following error:
As far as I know, this should not return multiple definitions since I am restricting the code from being defined more than once. I also tried using the precompiled directive "#pragma once"