uversion.h:128:8: error: using namespace directive in global context in header [-Werror,-Wheader-hygiene] U_NAMESPACE_USE

421 views
Skip to first unread message

Patrick Wright

unread,
Jan 30, 2017, 11:16:45 AM1/30/17
to Chromium-dev
I had the following header to a file:

WebKit/Source/web/WebViewImpl.h


and I get the following error:

I think what is in bold is the problem. Would it be possible to define U-NAMESPACE_USE with a different namespace other than U_ICU_NAMESPACE



third_party/icu/source/common/unicode/uversion.h:128:8: error: using namespace directive in global context in header [-Werror,-Wheader-hygiene]
       U_NAMESPACE_USE
       ^
../../third_party/icu/source/common/unicode/uversion.h:121:44: note: expanded from macro 'U_NAMESPACE_USE'
#   define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE;
                                           ^
../../third_party/icu/source/common/unicode/uversion.h:114:32: note: expanded from macro 'U_ICU_NAMESPACE'
#       define U_ICU_NAMESPACE U_ICU_ENTRY_POINT_RENAME(icu)
                               ^
../../third_party/icu/source/common/unicode/uvernum.h:113:40: note: expanded from macro 'U_ICU_ENTRY_POINT_RENAME'
#define U_ICU_ENTRY_POINT_RENAME(x)    U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_ICU_VERSION_SUFFIX)
                                       ^
../../third_party/icu/source/common/unicode/uvernum.h:112:44: note: expanded from macro 'U_DEF2_ICU_ENTRY_POINT_RENAME'
#define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y) U_DEF_ICU_ENTRY_POINT_RENAME(x,y)
                                           ^
../../third_party/icu/source/common/unicode/uvernum.h:111:43: note: expanded from macro 'U_DEF_ICU_ENTRY_POINT_RENAME'
#define U_DEF_ICU_ENTRY_POINT_RENAME(x,y) x ## y
                                          ^
<scratch space>:14:1: note: expanded from here
icu_58
^
1 error generated.
ninja: build stopped: subcommand failed.



chromium documentation states the following:

If you get the error:
  • using namespace directive in global context in header [-Wheader-hygiene]
It's because you did something like this in a header:

using namespace WebKit;

class OurDerivedClass : public WebKitType {
};

You can fix this by removing the "using namespace" line and explicitly stating the namespace:

class OurDerivedClass : public WebKit::WebKitType {
};

Is there a way to apply the above to my situation?

Any ideas I am willing to try. Is it possible to try renaming the namespace? 

thanks

Patrick Wright

unread,
Feb 2, 2017, 6:18:19 PM2/2/17
to Chromium-dev
I had to include the proper config files

Paweł Hajdan, Jr.

unread,
Feb 3, 2017, 2:36:04 AM2/3/17
to wrig...@gmail.com, Chromium-dev
Glad you got this resolved.

Please consider explaining here what the proper config files were, in case someone with the same issue finds this thread. See https://xkcd.com/979/ .

Paweł

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Patrick Wright

unread,
Feb 4, 2017, 12:28:08 PM2/4/17
to Chromium-dev, wrig...@gmail.com
sure,

Adding the following config files resolved the two errors I was receiving:

config += [  "//third_party/icu:icu_config", 
"//third_party/WebKit/Source:inside_blink",]


../../third_party/icu/source/common/unicode/uversion.h:128:9: error: using namespace directive in global context in header [-Werror,-Wheader-hygiene]

../../third_party/WebKit/Source/core/html/track/TrackBase.h:43:47: error: no viable conversion from returned value of type 'const WTF::String' to function return type 'WebMediaPlayer::TrackId' (aka 'blink::WebString')




fortunately, ":inside blink" was already being used in my BUILD.gn file already. I created a "+=" Config section in my target and included it. Fortunately, Solved that issue.

For the "using global namespace header" error. I looked in the BUILD.gn file that included the header file (chromium/src/third_party/icu/BUILD.gn) and saw what type of configs were available and was able to try what was available to include there. 
Reply all
Reply to author
Forward
0 new messages