Click here to Skip to main content
15,905,612 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
typedef enum {cstDisableState=0, cstUncheckedState=1, cstCheckedState} eCellCheckStateType;

void SetCheck(eCellCheckStateType bChecked);

CGridCellCheck* pCell = dynamic_cast<CGridCellCheck*>(
                                            m_gridctrl.GetCell(row, Column));

if (pCell)
{
pCell->SetCheck(static_cast<ecellcheckstatetype>(cstUncheckedState)); //error is here
}

error C2664: 'CGridCellTriStateCheck::SetCheck' : cannot convert parameter 1 from 'CSFT::eCellCheckStateType' to 'eCellCheckStateType'
        Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
</ecellcheckstatetype>


What am i doing wrong?
Posted

1 solution

Do you have the same enum defined twice in different namespaces or classes?
 
Share this answer
 
Comments
amarasat 16-Aug-11 15:46pm    
Yes, i have eCellCheckStateType enum defined them in two classes.

in

1.)header1.h::
typedef enum {cstDisableState=0, cstUncheckedState=1, cstCheckedState} eCellCheckStateType;
2.)header2.h::
#include header1.h
typedef enum ....
amarasat 16-Aug-11 15:53pm    
I removed it in one of the file and its working, Thanks a lot. I just cant believe i missed a small thing and posted a question here. Thanks a lot again.
Albert Holguin 17-Aug-11 1:33am    
Good catch John...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900