Ambiguous symbols possibly caused by Boost 1.69.0
Hi, I'm getting several instances of the following kind of error when I build my code, which does not use boost::thread, etc., as I use the STD versions: 1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\condition_variable(1 24): error C2872: 'xtime': ambiguous symbol 1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\thr\xtimec.h(18): note: could be 'xtime' 1>c:\program files\boost\boost\thread\lock_types.hpp(31): note: or 'boost::xtime' My research turned up: https://svn.boost.org/trac10/ticket/11477?cversion=0&cnum_hist=10 So I added the following value for Windows 10 to my preprocessor: _WIN32_WINNT=0x0601; Unfortunately, this makes no difference. Can anybody advise me of a way forward, please? Best wishes. Tim Burgess Raised Bar Ltd. E: mailto:tim@raisedbar.net tim@raisedbar.net M: +44 (0)7989 486976
On 27/02/2019 12:04, Tim Burgess wrote:
I'm getting several instances of the following kind of error when I build my code, which does not use boost::thread, etc., as I use the STD versions:
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\condition_variable(124): error C2872: 'xtime': ambiguous symbol
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\thr\xtimec.h(18): note: could be 'xtime'
1>c:\program files\boost\boost\thread\lock_types.hpp(31): note: or 'boost::xtime'
Make sure you don't have "using namespace boost;" inside any header files (unless within method scope), and if you have it in source files, ensure it only appears after all #includes. (Then also follow this rule for any "using namespace" statements, because they may eventually bite you similarly.)
Hi Gavin,
Just to be clear, is it just "using namespace boost;" I need to worry about,
or do I also need to strip out entries like "using namespace
boost::filesystem;"?
Best wishes.
Tim Burgess
-----Original Message-----
From: Boost-users
I'm getting several instances of the following kind of error when I build my code, which does not use boost::thread, etc., as I use the STD versions:
1>c:\program files (x86)\microsoft visual
studio\2017\community\vc\tools\msvc\14.16.27023\include\condition_variable(1 24):
error C2872: 'xtime': ambiguous symbol
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\thr\xtimec.h(18): note: could be 'xtime'
1>c:\program files\boost\boost\thread\lock_types.hpp(31): note: or 'boost::xtime'
Make sure you don't have "using namespace boost;" inside any header files (unless within method scope), and if you have it in source files, ensure it only appears after all #includes. (Then also follow this rule for any "using namespace" statements, because they may eventually bite you similarly.) _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
On Wed, 27 Feb 2019 at 11:05, Tim Burgess via Boost-users < boost-users@lists.boost.org> wrote:
Hi Gavin,
Just to be clear, is it just "using namespace boost;" I need to worry about, or do I also need to strip out entries like "using namespace boost::filesystem;"?
"using namespace xxx" is probably a bad idea in any [if not all] case[s], if the namespace is lengthy [as they tend to be in Boost], it would be better to define a (distinctive) namespace alias. degski -- *"Big boys don't cry" - **Eric Stewart, Graham Gouldman*
On 27.02.2019 16:53, degski via Boost-users wrote:
On Wed, 27 Feb 2019 at 11:05, Tim Burgess via Boost-users
mailto:boost-users@lists.boost.org> wrote: Hi Gavin,
Just to be clear, is it just "using namespace boost;" I need to worry about, or do I also need to strip out entries like "using namespace boost::filesystem;"?
"using namespace xxx" is probably a bad idea in any [if not all] case[s], if the namespace is lengthy [as they tend to be in Boost], it would be better to define a (distinctive) namespace alias.
They are a particularly bad idea in public header files. Best regards, Leon
OK, noted. Must admit the project I’ve been working on has made me a little wiser, even if a lot older😊
Best wishes.
Tim Burgess
From: Boost-users
On Wed, 27 Feb 2019 at 18:01, Tim Burgess via Boost-users < boost-users@lists.boost.org> wrote:
OK, noted. Must admit the project I’ve been working on has made me a little wiser, even if a lot older😊
Next step, don't top-post (there's a link somewhere [on Boost.org] about this, but I don't have it)! degski -- *"Big boys don't cry" - **Eric Stewart, Graham Gouldman*
Next step, don't top-post (there's a link somewhere [on Boost.org] about this, but I don't have it)! TB: It’s here and I take the ppoint: https://www.boost.org/community/policy.html#quoting
On Wed, 27 Feb 2019 at 18:12, Tim Burgess via Boost-users < boost-users@lists.boost.org> wrote:
Next step, don't top-post (there's a link somewhere [on Boost.org] about this, but I don't have it)!
TB: It’s here and I take the ppoint:
No worries. I'm an avid follower of the cfe-dev http://lists.llvm.org/pipermail/llvm-dev/ list, because that [Clang] is what I use on a daily basis. They don't follow this rule [and only top-post], and it's an absolute horror to read the mailing list. They [the Clang devs] don't seem to mind. I'm not in any position to tell them to sanitize their posing habits [because I've got nothing to contribute to Clang], so I put up with it, but it's a pain in the proverbial behind. I'm happy Boost does much better. degski -- *"Big boys don't cry" - **Eric Stewart, Graham Gouldman*
Hi,
Turns out that I needed to get rid of boost::filesystem for other reasons
anyway and there were only a few instances of namespace boost - problem
solved.
Many thanks.
Best wishes.
Tim Burgess
-----Original Message-----
From: Boost-users
I'm getting several instances of the following kind of error when I build my code, which does not use boost::thread, etc., as I use the STD versions:
1>c:\program files (x86)\microsoft visual
studio\2017\community\vc\tools\msvc\14.16.27023\include\condition_variable(1 24):
error C2872: 'xtime': ambiguous symbol
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\thr\xtimec.h(18): note: could be 'xtime'
1>c:\program files\boost\boost\thread\lock_types.hpp(31): note: or 'boost::xtime'
Make sure you don't have "using namespace boost;" inside any header files (unless within method scope), and if you have it in source files, ensure it only appears after all #includes. (Then also follow this rule for any "using namespace" statements, because they may eventually bite you similarly.) _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
On 27/02/2019 22:05, Tim Burgess wrote:
Just to be clear, is it just "using namespace boost;" I need to worry about, or do I also need to strip out entries like "using namespace boost::filesystem;"?
"using namespace boost" is the only one that would cause that specific error (when used before some CRT #include), but as I did say:
(Then also follow this rule for any "using namespace" statements, because they may eventually bite you similarly.)
you should avoid it in general. "using namespace" is a shotgun; you need to be careful both of what you're pointing it at, as well as where you're standing when you do so.
participants (4)
-
degski
-
Gavin Lambert
-
Leon Mlakar
-
tim@raisedbar.net