Error:
CMakeFiles\Final_Project_2nd.dir/objects.a(Tab.cpp.obj): In function `Z8Type2IntNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE':
C:/Users/Andrea/CLionProjects/Final_Project_2nd/Utils.hpp:37: multiple definition of `Type2Int(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
CMakeFiles\Final_Project_2nd.dir/objects.a(main.cpp.obj):C:/Users/Andrea/CLionProjects/Final_Project_2nd/Utils.hpp:37: first defined here
I've created a header Utils.hpp
with two enum
s and two functions and I included it wherever I needed to use these things:
enum Types {
OptionInt,
OptionFloat,
[...]
OptionInvalid
};
enum Commands {
CommandCreate = OptionInvalid + 1,
CommandDrop,
[...]
CommandInvalid
};
Types Type2Int(string type){
if(type == "int") return OptionInt;
if(type == "float") return OptionFloat;
[...]
return OptionInvalid;
}
Commands Command2Int(string command){
if(command == "CREATE") return CommandCreate;
if(command == "DROP") return CommandDrop;
[...]
return CommandInvalid;
}