user1541055
user1541055

Reputation: 119

error C2440: 'type cast' : cannot convert from 'bool' to 'CString'

I am getting the following error:

C2440: 'type cast' : cannot convert from 'bool' to 'CString'

for the following code:

if ((CString)XSave->GetVersionAt(j).HasService_Ref())
    m_pVersion->SetstrServicesRef((CString)XSave->GetVersionAt(j).GetService_Ref());

Any help is appreciated.

Upvotes: 0

Views: 1408

Answers (1)

Rost
Rost

Reputation: 9089

Looks like HasService_Ref returns bool but you casts it to CString occasionally inside if condition. Remove the cast and it shall work.

Upvotes: 1

Related Questions