Home > ambiguous symbol > error c2872 ambiguous symbol namespace

Error C2872 Ambiguous Symbol Namespace

Contents

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more ambiguous symbol definition about Stack Overflow the company Business Learn more about hiring developers or posting error c2872: 'cdialogimpl' : ambiguous symbol ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack error c2872: 'string' : ambiguous symbol Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Ambiguous symbol up vote 2 down vote favorite I have declared

C++ Ambiguous Symbol Namespace

a class Integer in a custom namespace: namespace MyNameSpace { class Integer {}; } And I am using it in a method like this: void someMethod() { using namespace MyNameSpace; SomeClass x(Integer("some text", 4)); } This gives 10> error C2872: 'Integer' : ambiguous symbol 10> could be 'g:\lib\boost\boost_1_47_0\boost/concept_check.hpp(66) : boost::Integer' 10> or '[my file] : MyNameSpace::Integer' I have searched my code base for "namespace boost" and "using boost" with ambiguous symbol visual studio fulltext search but didn't find a line like "using namespace boost;". This is supported by the test that void someMethod() { shared_ptr x; using namespace MyNameSpace; //SomeClass x(Integer("some text", 4)); } gives error C2065: 'shared_ptr' : undeclared identifier whereas void someMethod() { boost::shared_ptr x; using namespace MyNameSpace; //SomeClass x(Integer("some text", 4)); } compiles. Is there any other reason why the "ambiguous symbol" error can occur?? c++ visual-studio-2008 share|improve this question edited Aug 27 '12 at 11:13 asked Aug 27 '12 at 10:56 Philipp 6,14833384 Isn't "Integer" a reserved word ?? –Orabîg Aug 27 '12 at 11:01 1 There could be a using boost::Integer somewhere. –juanchopanza Aug 27 '12 at 11:01 Try and specify MyNameSpace::Integer in SomeClass x(Integer(4)); in order to tell the compiler this is the Integer you want. –fritzone Aug 27 '12 at 11:05 1 Nitpick: "namespace" is a single word, so don't capitalize the 's'. ;) Question: Are you actually initializing the Integer class with a literal 4 or something else? ADL could trick you here. Although, if you initialize it with a variable, that should trigger the most-vexing-parse and not an "ambiguous symbol" error.. hmm... –Xeo Aug 27 '12 at 11:14 3 "This

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company string is ambiguous c++ Business Learn more about hiring developers or posting ads with us Stack Overflow Questions

Error C2872 Ambiguous Symbol Visual C++

Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million

C++ Error C2872

programmers, just like you, helping each other. Join them; it only takes a minute: Sign up What can cause ambiguous symbol errors on one computer and not another? up vote 1 down vote favorite I'm using Visual http://stackoverflow.com/questions/12140669/ambiguous-symbol Studio 2010 to work on C++ code. The project and all its contents have been written by someone else, and copied onto a shared drive. When the creator builds it on his computer, it works fine. When I try to build the solution, I get a whole bunch of these errors error C2872: '' : ambiguous symbol could be '[File].cpp(66) : anonymous-namespace'::' or '[Different file].h(549) : `anonymous-namespace'::'. Here's an example of a line which http://stackoverflow.com/questions/10079230/what-can-cause-ambiguous-symbol-errors-on-one-computer-and-not-another is said to be in error: std::pair> b) -> bool { return (a.second.second < b.second.second ); }); It seems like the error always occurs with a line which ends in '});'. The full code is rather enormous to show here, and it works on other computers, so presumably it's a problem with my settings or something. Can anybody hazard a guess as to what they may be? c++ visual-studio-2010 compiler-errors share|improve this question edited Apr 10 '12 at 0:09 Hans Passant 653k819581603 asked Apr 9 '12 at 20:15 Fish 4016 Check ANSI codepage. –Joshua Apr 9 '12 at 20:16 1 does your compiler support c++11? –juanchopanza Apr 9 '12 at 20:20 2 Same patch level for VS? –0xC0000022L Apr 9 '12 at 20:36 Thanks, STATUS_ACCESS_DENIED (and juanchopanza - that helped me figure out what a lambda was). It turns out to have been a problem with my version - I was missing the patch that fixed this bug. –Fish Apr 10 '12 at 18:06 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote Not sure if you've seen this or not but according to MSDN page for that compiler error: C2872 can occur if a header file includes a using Directive (C++), and a subsequent he

Visual Studio Languages , Windows Desktop Development > C++ Standards, Extensions, and Interop Question 0 Sign in to vote The following compiles in gcc and clang. https://social.msdn.microsoft.com/Forums/vstudio/en-US/38ab97d5-fb85-4707-9551-15a358b2e620/avoiding-ambiguous-symbol-error-in-msvc-gcc-compiles-ok?forum=vclanguage It fails compilation in msvc due to ambiguous symbols (error C2872). #include namespace foo { typedef unsigned long uint32; } namespace bar { typedef unsigned long uint32; } using namespace foo; https://qualapps.blogspot.com/2008/07/using-atlstrh-in-managed-project.html using namespace bar; int main() { uint32 test = 5; printf("%lu\n", test); } It appears that gcc and clang are realizing that the typedefs are resolving to the same type (if I ambiguous symbol change one of typedef to a different type, gcc/clang obviously fails) Besides the correcting the obvious issues with the code, is there an option to relax the error? Tuesday, March 15, 2016 5:00 AM Reply | Quote Answers 1 Sign in to vote On 3/15/2016 1:00 AM, Nick.Schultz wrote: The following compiles in gcc and clang. It fails compilation in msvc due to ambiguous symbols error c2872 ambiguous (error C2872). #include namespace foo { typedef unsigned long uint32; } namespace bar { typedef unsigned long uint32; } using namespace foo; using namespace bar; int main() { uint32 test = 5; printf("%lu\n", test); } My reading of the standard is that GCC and Clang are right and MSVC is wrong. """ [namespace.udir]/2 A using-directive specifies that the names in the nominated namespace can be used in the scope in which the using-directive appears after the using-directive. During unqualified name lookup (3.4.1), the names appear as if they were declared in the nearest enclosing namespace which contains both the using-directive and the nominated namespace. """ This says that the lookup should find both declarations, as if "typedef unsigned long uint32;" appeared twice in the global namespace. """ [namespace.udir]/6 If name lookup finds a declaration for a name in two different namespaces, and the declarations do not declare the same entity and do not declare functions, the use of the name is ill-formed. """ This implies that it's OK to find multiple declarations, as long as they declare the same entity. """ [basic]/3 An entity is a value, object, reference, fun

easy but it wasn't working. [Note: Microsoft factored CString from MFC several years ago, so CString can now be used standalone. Super handy class.]I started with what I thought was a reasonable statement:
#include "cstringt.h"
This gave me numerous errors, starting with:C:\Program Files\Microsoft SDKs\Windows\v6.0\Include\ocidl.h(6238) : error C2872: 'IServiceProvider' : ambiguous symbol
C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include\atlcomcli.h(370) : error C2872: 'DISPPARAMS' : ambiguous symbolWith a little research, I determined I was using the wrong include file. So I switched to:
#include "atlstr.h"
When I tried to do that, I received similar errors:
C:\Program Files\Microsoft SDKs\Windows\v6.0\Include\ocidl.h(6238) : error C2872: 'IServiceProvider' : ambiguous symbol
C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include\atlcomcli.h(370) : error C2872: 'DISPPARAMS' : ambiguous symbol
Several other posts inquiring about the same errors received no answers.The problem is caused because the Microsoft SDK (aka Platform SDK) and mscorlib both have definitions for these classes.The solution is to take the #include file that caused the problem and make sure it is placed before any "using namespace" statement. In my case, that meant moving #include near the top of stdafx.h. Posted by Jim Beveridge at 12:05 PM 12 comments: GoogledMay 7, 2009 at 12:31 AMFinally one quick solution after lot of googling. Thank you very much.ReplyDeleteAnonymousMay 19, 2009 at 8:06 AMThanks!ReplyDeleteAnonymousJune 1, 2009 at 11:53 AMThank you so much....it was a HUGE help!!ReplyDeleteAnonymousNovember 23, 2009 at 5:37 PMAwesome, but I still don't fully understand why it works.ReplyDeleteAnonymousSeptember 20, 2010 at 5:59 AMHi JimI am facing similar problem but unable to fis it.I am making a project and attaching a library code in it. Both projects are made with same project setting . In library project i have header file where i typedef CString but when i am compiling the main project I am getting following errorsC:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include\afxwin.h(3343): error C2872: 'CString' : ambiguous symbolI tried changing the order of stdafx.h and other header files but no success.Please help me out.ReplyDeleteJim BeveridgeSeptember 20, 2010 at 8:51 AMI'm not sure what you mean when you say "I typedef CString", but you can't typedef CString. You can only use the definitions that appear in the ATL header files because it's really a template underneath the covers. In any case, if CString were in your precompiled headers, there s

 

Related content

ambiguous symbol error

Ambiguous Symbol Error table id toc tbody tr td div id toctitle Contents div ul li a href Error C Istream Ambiguous Symbol a li li a href Idataobject Ambiguous Symbol a li li a href Ambiguous Symbol Definition a li li a href Shared ptr Ambiguous Symbol a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn relatedl more about Stack Overflow the company Business Learn more about hiring developers p

ambiguous symbol error c2872

Ambiguous Symbol Error C table id toc tbody tr td div id toctitle Contents div ul li a href Error C filetime Ambiguous Symbol a li li a href Error C idataobject Ambiguous Symbol a li li a href Error C string Ambiguous Symbol a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more relatedl about Stack Overflow the company Business Learn more about hiring developers error c dword ambiguous symbol

error 1 error c2872 ambiguous symbol

Error Error C Ambiguous Symbol table id toc tbody tr td div id toctitle Contents div ul li a href Ambiguous Symbol Visual Studio a li li a href C Ambiguous Symbol Namespace a li li a href Error C string Ambiguous Symbol a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to relatedl any questions you might have Meta Discuss the ambiguous symbol definition workings and policies of this site About Us Learn more about Stack p h id Ambiguous Symbol Visual Studio p Overflow the company Business

error 2 error c2872 ambiguous symbol

Error Error C Ambiguous Symbol table id toc tbody tr td div id toctitle Contents div ul li a href Error C string Ambiguous Symbol a li li a href Ambiguous Symbol Visual Studio a li li a href C Ambiguous Symbol Namespace a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more relatedl about Stack Overflow the company Business Learn more about hiring developers or ambiguous symbol definition posting ads

error 2872

Error table id toc tbody tr td div id toctitle Contents div ul li a href C Corral a li li a href Error C cdialogimpl Ambiguous Symbol a li li a href Ambiguous Symbol Definition a li ul td tr tbody table p games PC games error c ambiguous symbol c Windows games Windows phone games Entertainment All Entertainment error c string ambiguous symbol Movies TV Music Business Education Business Students educators p h id C Corral p Developers Sale Sale Find a store Gift cards Products Software services Windows Office Free downloads security Internet p h id Error

error c2872 ambiguous symbol

Error C Ambiguous Symbol table id toc tbody tr td div id toctitle Contents div ul li a href Error C string Ambiguous Symbol a li li a href Ambiguous Symbol Definition a li li a href Ambiguous Symbol Visual Studio a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this relatedl site About Us Learn more about Stack Overflow the company Business error c dword ambiguous symbol Learn more about hiring developers or posting ads

error c2872 ambiguous

Error C Ambiguous table id toc tbody tr td div id toctitle Contents div ul li a href Error C filetime Ambiguous Symbol a li li a href Error C string Ambiguous Symbol a li li a href Error C iserviceprovider Ambiguous Symbol a li li a href Ambiguous Symbol Definition a li ul td tr tbody table p resources Windows Server resources Programs MSDN subscriptions Overview Benefits relatedl Administrators Students Microsoft Imagine Microsoft Student Partners error c dword ambiguous symbol ISV Startups TechRewards Events Community Magazine Forums Blogs Channel p h id Error C filetime Ambiguous Symbol p Documentation

error symbol is ambiguous

Error Symbol Is Ambiguous table id toc tbody tr td div id toctitle Contents div ul li a href Error C iserviceprovider Ambiguous Symbol a li li a href Error C Ambiguous Symbol C a li li a href Ambiguous Symbol Definition a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more relatedl about Stack Overflow the company Business Learn more about hiring developers or error c ambiguous symbol posting ads

idataobject ambiguous symbol error

Idataobject Ambiguous Symbol Error table id toc tbody tr td div id toctitle Contents div ul li a href Error C Ambiguous Symbol a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to relatedl any questions you might have Meta Discuss the iserviceprovider ambiguous symbol servprov h workings and policies of this site About Us Learn more about Stack cannot use this indirection on type iserviceprovider Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs error c filetime ambiguous symbol

iserviceprovider error

Iserviceprovider Error table id toc tbody tr td div id toctitle Contents div ul li a href Error C filetime Ambiguous Symbol a li li a href Error C Ambiguous Symbol a li li a href System string To Std string a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and relatedl policies of this site About Us Learn more about Stack c cli iserviceprovider ambiguous symbol Overflow the company Business Learn more about hiring developers or posting ads

iserviceprovider ambiguous symbol error

Iserviceprovider Ambiguous Symbol Error table id toc tbody tr td div id toctitle Contents div ul li a href Iserviceprovider Ambiguous Symbol Servprov H a li li a href Error C filetime Ambiguous Symbol a li li a href System string To Std string a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to any questions you might relatedl have Meta Discuss the workings and policies of this p h id Iserviceprovider Ambiguous Symbol Servprov H p site About Us Learn more about Stack Overflow the company Business Learn