Compiler Error C2440 (Windows CE 5.0)

Send Feedback

'conversion' : cannot convert from 'type1' to 'type2'

The compiler cannot cast from 'type1' to 'type2.'

If you encounter this error on code that compiled with an earlier version of Microsoft® eMbedded Visual C++®, see Technote: Improved Conformance to ANSI C++.

The following example shows how this error might occur.

void main()
{
   int anInteger;
                int *ptrToAnInt;
                ptrToAnInt = &anInteger;

//  C compiler converts aVoidPointer to integer pointer.
                void *aVoidPointer;
                aVoidPointer = ptrToAnInt;    

//  C++ compiler will fail without an explicit cast.
                ((int *)aVoidPointer) = ptrToAnInt}
}

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.