Ambiguous character - cannot be converted from ado :: DataTypeEnum to DataTypeEnum

Trying to compile a C ++ project containing the SQL library and get these errors:

error C2664: 'CNCQuickADO::ConvertADOType' : cannot convert parameter 1 from 'ado20::DataTypeEnum' to 'DataTypeEnum'
    Conversion to enumeration type requires an explicit cast
error C2664: 'CNCQuickADO::ConvertADOType' : cannot convert parameter 1 from 'ado20::DataTypeEnum' to 'DataTypeEnum'
    Conversion to enumeration type requires an explicit cast
error C2872: 'DataTypeEnum' : ambiguous symbol
    could be 'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\dbdaoint.h : DataTypeEnum
    or 'c:\amc\source\amthrottling\release\msado15.tlh : ado20::DataTypeEnum

I use the SQL library in several other projects without such problems. So I guess this should be related to where I include the library?

Can anyone help? Thanks!

+4
source share
2 answers

You may be using namespace ado20somewhere in the code. To tell the compiler that you want to use a global type DataTypeEnum(which you probably do, as it CNCQuickADO::ConvertADOType()expects judgment from error messages), declare your variable with the full type ::DataTypeEnum.

+6

- ++.

ado20::DataTypeEnum, ado20 - , DataTypeEnum - .

ado20::DataTypeEnum othernamespace::DataTypeEnum - , .

++ , . , ado20::DataTypeEnum _ado20_DataTypeEnum, othernamespace::DataTypeEnum be _othernamespace_DataTypeEnum.

:

using namespace ado20; // declare the namespace 
// other code ...
DateTypeEnum yourvariable; // now you can directly use variable in the namespace
0

Source: https://habr.com/ru/post/1527452/


All Articles