'conversion' : cannot convert from 'type1' to 'type2'
The compiler cannot cast from ‘type1’ to ‘type2’. Several situations can generate C2440.
class CMyClass { public: explicit CMyClass( int iBar) throw() { } }; void main() { CMyClass myclass = 2; // conversion required // try the following // CMyClass myclass(2); // or // CMyClass myclass = (CMyClass)2; int *i; float j; j = (float)i; // cannot cast from pointer to int to float }
If you encounter this error on code that compiled with an earlier version of Visual C++, see Technote: Improved Conformance to ANSI C++.