Closed kjp949 closed 9 years ago
Hi @kpeterson11,
It's failing because that instance of std::map
is constructed by assigning from an initializer list:
static const std::map names_by_flag = { pair_0, pair_1, ..., pair_n }
This is not legal on pre C++11 compilers and pre C++11 standard libraries. Depending on whether this is a compiler problem, library problem or both, we could:
build_names_by_flag()
, used to initialise names_by_flag
.std::map
doesn't still have it in the library you are using, then we could just create the std::map
instance and then insert the new elements. This is how you can substitute the initialisation of the two maps in event.cpp
: static std::map<fsw_event_flag, std::string> build_names_by_flag();
static std::map<std::string, fsw_event_flag> build_flag_by_names();
static const std::map<fsw_event_flag, std::string> names_by_flag = build_names_by_flag();
static std::map<fsw_event_flag, std::string> build_names_by_flag()
{
std::map<fsw_event_flag, std::string> m;
#define FSW_MAKE_PAIR_FROM_NAME(p) m[p] = #p;
FSW_MAKE_PAIR_FROM_NAME(NoOp)
FSW_MAKE_PAIR_FROM_NAME(PlatformSpecific)
FSW_MAKE_PAIR_FROM_NAME(Created)
FSW_MAKE_PAIR_FROM_NAME(Updated)
FSW_MAKE_PAIR_FROM_NAME(Removed)
FSW_MAKE_PAIR_FROM_NAME(Renamed)
FSW_MAKE_PAIR_FROM_NAME(OwnerModified)
FSW_MAKE_PAIR_FROM_NAME(AttributeModified)
FSW_MAKE_PAIR_FROM_NAME(MovedFrom)
FSW_MAKE_PAIR_FROM_NAME(MovedTo)
FSW_MAKE_PAIR_FROM_NAME(IsFile)
FSW_MAKE_PAIR_FROM_NAME(IsDir)
FSW_MAKE_PAIR_FROM_NAME(IsSymLink)
FSW_MAKE_PAIR_FROM_NAME(Link)
#undef FSW_MAKE_PAIR_FROM_NAME
return m;
}
static const std::map<std::string, fsw_event_flag> flag_by_names = build_flag_by_names();
static std::map<std::string, fsw_event_flag> build_flag_by_names()
{
std::map<std::string, fsw_event_flag> m;
#define FSW_MAKE_PAIR_FROM_NAME(p) m[#p] = p;
FSW_MAKE_PAIR_FROM_NAME(NoOp)
FSW_MAKE_PAIR_FROM_NAME(PlatformSpecific)
FSW_MAKE_PAIR_FROM_NAME(Created)
FSW_MAKE_PAIR_FROM_NAME(Updated)
FSW_MAKE_PAIR_FROM_NAME(Removed)
FSW_MAKE_PAIR_FROM_NAME(Renamed)
FSW_MAKE_PAIR_FROM_NAME(OwnerModified)
FSW_MAKE_PAIR_FROM_NAME(AttributeModified)
FSW_MAKE_PAIR_FROM_NAME(MovedFrom)
FSW_MAKE_PAIR_FROM_NAME(MovedTo)
FSW_MAKE_PAIR_FROM_NAME(IsFile)
FSW_MAKE_PAIR_FROM_NAME(IsDir)
FSW_MAKE_PAIR_FROM_NAME(IsSymLink)
FSW_MAKE_PAIR_FROM_NAME(Link)
#undef FSW_MAKE_PAIR_FROM_NAME
return m;
}
Let me know if this works on FreeBSD 9.3. If it is, I will apply this patch to fswatch
upstream.
Hi @kpeterson11,
I've released fswatch
1.5.1 and I've updated my FreeBSD port. This port successfully builds on 9.3-RELEASE
and 10.1-RELEASE
. You can find more instructions here.
I can't compile
fswatch
1.5 on FreeBSD 9.3. I have tried using clang 3.4, 3.5, 3.6 and 3.8. They all fail. I can compilefswatch
1.4.6 with no troubles.Here is the output when I tried compiling with clang 3.6: