I have a large project library and a few files I added myself. One of them is a header file that contains some enum
s I use across the project. It looks something like this:
#ifndef MYMANYENUMS
#define MYMANYENUMS
namespace my_ns {
enum class RecType { NONE, L1, L2 };
inline int operator+ ( RecType t )
{ return underlying_type<RecType >::type(t); }
static const map<RecType, string> RecTypeMap = {
{ RecType ::NONE, "NONE" },
{ RecType ::L1, "L1" },
{ RecType ::L2, "L2" },
};
}
I include this header in a lot of other headers across the project without issues. Now I added a new header file:
#ifndef THEOTHERHEADER_H
#define THEOTHERHEADER_H
#include "MyManyEnums.h"
#endif
This file is completely empty besides what shown above. As soon as I compile I get errors:
map does not name a type
underlying_type was not declared in this scope
in my enums header file. I am pretty confused why this all of a sudden breaks. I am using qtcreator and gcc. I cant create a small example and post here that would replicate the error. I assume it must be an issue with the project structure. But I have no idea where to look and what to try so if someone can point me to potential issues that I can investigate, that would be helpful.