The best would be if absail didn't have anything named StrCat because as long as they have, they, or users of absail, will run into problems like this.
The second "typical" solution is to make sure that the macro is always defined, and that is the reason windows_types.h exists. If you include windows_types.h before including absail headers, then it will always be StrCatW for the compiler and it will be happy. On the other hand it can lead to link errors instead unless all StrCat users do the same.
It's also possible that you can get away with an #undef StrCat at a good place, but it can become a source of future problems and inconsistencies so it wouldn't be my first option. For the same reason I would prefer to not try to find a different solution to bug 817738 .
(It's ok to curse the 30 year old decision to make all Win32 API functions macros, we all do it)
bratell@ has summarized the issue very well. As the creator of windows_types.h I *hate* the fact that it #defines these names, but pragramatically it was the only solution that I could get working.
We could try removing StrCat from the list of macros that are defined and then see how many #undefs we need, but I'm not very hopeful. You could also try #undefing StrCat just in WebRTC. It is very hard to predict what will work.
I plan to do another push to remove Windows.h from more of Chromium's source code at some point and that might eventually make removing more macros more practical, but until then...
We talked to abseil team about this issue.
They haven't seen it before.
Counter-suggestion was to undef StrCat everywhere instead of defining it everywhere (it is a deprecated api so shouldn't be used anyway).
That might be not the smallest, but seems cleanest long-term approach.
I've made a draft CL that does it (https://chromium-review.googlesource.com/c/chromium/src/+/1117180)
with an implicit suggestion to avoid including windows headers directly.
windows compile try bots seems fine. Does that mean it can work?
(I also have a plan B hack to allow absl::StrCat just in webrtc.
https://webrtc-review.googlesource.com/c/src/+/85680
but though webrtc is 1st user of abseil in chromium, it is not the only one, so it might be better to move towards solution that works for all chromium libraries)
Comment 1 by jonasolsson@chromium.org
, Jun 26 2018