Home > ambiguous symbol > ambiguous symbol error c2872

Ambiguous Symbol Error C2872

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 about Stack Overflow the company Business Learn more about hiring developers error c2872 'dword' ambiguous symbol or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x

Error C2872 'filetime' Ambiguous Symbol

Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it

Error C2872 'idataobject' Ambiguous Symbol

only takes a minute: Sign up getting error for ambiguous symbol and need help to remove it up vote 1 down vote favorite 1 i am getting this error which i unable to remove in visual studio 2010. i am

Error C2872 'string' Ambiguous Symbol

using one third party library which uses its own definition for "string" Also visual studio's xstring file is there in the folder where it gets installed. now when i am trying to compile code i am getting following error 1>...\xyz.cpp(24): error C2872: 'string' : ambiguous symbol 1> could be 'third party library path\string.h(31) 1> or 'c:\program files (x86)\microsoft visual studio 10.0\vc\include\xstring(2063) : std::string' compiler is not able to understand which string definition it should use. How can i remove this error error c2872 'hash' ambiguous symbol in visual studi 2010. I want the code to use third party string definition. i tried to set third party path in include directory but still i am seeing this error. Please help me. Thanks in advance c++ share|improve this question asked Feb 20 '12 at 11:27 novice 19137 Use std::string instead of just string? –BoBTFish Feb 20 '12 at 11:30 @BoBTFish "I want the code to use third party string definition." ;) –user1203803 Feb 20 '12 at 11:31 add a comment| 5 Answers 5 active oldest votes up vote 5 down vote This is an example of a namespace clash. You probably have in your code: #include <3rdPartyString.h> // declaration of 3rd party string type #include // declaration of std::string using namespace 3rdPartyNamespace; using namespace std; ... string myStr; // which string type? Compiler now doesn't know which string you want to use - one from 3rd party library or STL one. You can resolve this ambiguity by prepending namespace name to the type: 3rdPartyNamespace::string myStr; // if you want to use string from 3rd party library or std::string myStr; // if you want to use STL string Never place using namespace namespace_name; in headers but try to avoid it in source files as well. The best practice is to prepend type name as this does doesn't pollute your current namespace with the other one thus avoiding namespace clashes. share|improve this answer answer

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the error c2872 'iserviceprovider' ambiguous symbol workings and policies of this site About Us Learn more about Stack ambiguous symbol definition Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions ambiguous symbol visual studio Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join http://stackoverflow.com/questions/9360375/getting-error-for-ambiguous-symbol-and-need-help-to-remove-it them; it only takes a minute: Sign up Ambiguous symbol String up vote 1 down vote favorite 1 I am writing a program in c++/cli and it is giving me the error: Error C2872: 'String' : ambiguous symbol I am using String as part of a function: Dictionary^>^>^ FalseTrigg(Dictionary^ imgParms, bool windowOn) Below is the http://stackoverflow.com/questions/16306728/ambiguous-symbol-string overall program. Thanks for any help. #include #include #include #include #include #include #include #pragma managed(push, off) #include "cv.h" #include "highgui.h" #include #include "opencv2/core/core.hpp" #include "opencv2/features2d/features2d.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/nonfree/nonfree.hpp" #include #pragma managed(pop) using namespace cv; using namespace std; using namespace System; using namespace System::Collections::Generic; using namespace System::Runtime::InteropServices; public ref class FalseTrig { public: FalseTrig() { } ~FalseTrig() { } Dictionary^>^>^ FalseTrigg(Dictionary^ imgParms, bool windowOn) {} }; c++-cli share|improve this question edited Apr 30 '13 at 18:46 David Yaw 18.3k23268 asked Apr 30 '13 at 18:36 fmvpsenior 72319 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote You've got two definitions for the class String, and the compiler doesn't know which one you need. There should be more lines to the error message, which will list the various 'string' classes it found. I'm not exactly sure which definitions it's finding, since std::string is supposed to be a lowercase "s", and you're using an uppercase "S". In your met

One games Xbox 360 games PC https://support.microsoft.com/en-us/kb/2890859 games Windows games Windows phone games Entertainment All https://qualapps.blogspot.com/2008/07/using-atlstrh-in-managed-project.html Entertainment Movies & TV Music Business & Education Business Students & educators Developers Sale Sale Find a store Gift cards Products Software & services Windows Office Free downloads & security ambiguous symbol Internet Explorer Microsoft Edge Skype OneNote OneDrive Microsoft Health MSN Bing Microsoft Groove Microsoft Movies & TV Devices & Xbox All Microsoft devices Microsoft Surface All Windows PCs & tablets PC accessories Xbox & games Microsoft Band Microsoft ambiguous symbol error Lumia All Windows phones Microsoft HoloLens For business Cloud Platform Microsoft Azure Microsoft Dynamics Windows for business Office for business Skype for business Surface for business Enterprise solutions Small business solutions Find a solutions provider Volume Licensing For developers & IT pros Develop Windows apps Microsoft Azure MSDN TechNet Visual Studio For students & educators Office for students OneNote in classroom Shop PCs & tablets perfect for students Microsoft in Education Support Sign in Cart Cart Javascript is disabled Please enable javascript and refresh the page Cookies are disabled Please enable cookies and refresh the page CV: {{ getCv() }} English (United States)‎ Terms of use Privacy & cookies Trademarks © 2016 Microsoft

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 precompile

 

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

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 c2872 ambiguous symbol namespace

Error C Ambiguous Symbol Namespace table id toc tbody tr td div id toctitle Contents div ul li a href C Ambiguous Symbol Namespace a li li a href Error C Ambiguous Symbol Visual C a li li a href C Error C 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 relatedl 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

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