CEGUI 0.7 error C2440:'initializing'

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

super
Just popping in
Just popping in
Posts: 2
Joined: Wed Apr 28, 2010 08:52

CEGUI 0.7 error C2440:'initializing'

Postby super » Wed Apr 28, 2010 08:56

I'm trying to build CEGUI following part2 of this guide http://ogre17crashcourse.blogspot.com/2 ... -work.html but I have this error

1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xmemory(208): error C2440: 'initializing' : cannot convert from 'int' to 'CEGUI::ListboxItem *'
1> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: CEGUI 0.7 error C2440:'initializing'

Postby CrazyEddie » Wed Apr 28, 2010 13:59

Use the snapshot code: viewtopic.php?f=6&t=4704 it should have these issues fixed.

CE

czzplnm
Just popping in
Just popping in
Posts: 6
Joined: Thu Aug 05, 2010 01:19

Re: CEGUI 0.7 error C2440:'initializing'

Postby czzplnm » Sat Aug 07, 2010 04:08

I have same error, could this be explained a tad more? Ive downloaded and applied those files.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: CEGUI 0.7 error C2440:'initializing'

Postby CrazyEddie » Sat Aug 07, 2010 13:50

You mean explain the error? It basically means that the 0 was interpreted as the interger zero which can't be implicitly cast by the compiler to a pointer type (ListboxItem*), so the compiler requires the cast to be explicit. Why does this show up only on this compiler and only now? To be honest, I didn't get into a deep analysis of the situation ;)

CE.

czzplnm
Just popping in
Just popping in
Posts: 6
Joined: Thu Aug 05, 2010 01:19

Re: CEGUI 0.7 error C2440:'initializing'

Postby czzplnm » Sat Aug 07, 2010 22:30

This is the block line erroring

Code: Select all

   template<class _Other>
      void construct(pointer _Ptr, _Other&& _Val)
      {   // construct object at _Ptr with value _Val
      ::new ((void _FARQ *)_Ptr) _Ty(_STD forward<_Other>(_Val));
      }


This is the line specifically,

Code: Select all

   ::new ((void _FARQ *)_Ptr) _Ty(_STD forward<_Other>(_Val));


This is the error specifically,

Code: Select all

Error   1   error C2440: 'initializing' : cannot convert from 'int' to 'CEGUI::ListboxItem *'   e:\program files (x86)\microsoft visual studio 10.0\vc\include\xmemory   208

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: CEGUI 0.7 error C2440:'initializing'

Postby CrazyEddie » Mon Aug 09, 2010 10:05

I'm not sure if you're asking this for academic purposes or if you are still getting this issue :?

The issue is fixed, and the fix is to explicitly cast the 0 to the CEGUI::ListboxItem* type. I know it's fixed and that this fix works because I was compiling it just fine on VC++ 2010 over the weekend ;)

CE.

czzplnm
Just popping in
Just popping in
Posts: 6
Joined: Thu Aug 05, 2010 01:19

Re: CEGUI 0.7 error C2440:'initializing'

Postby czzplnm » Tue Aug 10, 2010 02:09

More, educational purposes. I have hundreds of notes on everything. :(
Once again, thanks CE. I have overwhelmed myself with too big of tasks, so I am going to start in 2D side scroller.
Everything seems so clear in my head / notes, but my damn PC is too cluttered. Might go for a expensive monitor with ridiculous resolution, my 1360 x 768 cheap flat screens ain't cuttin it.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: CEGUI 0.7 error C2440:'initializing'

Postby CrazyEddie » Tue Aug 10, 2010 08:54

czzplnm wrote:More, educational purposes. I have hundreds of notes on everything. :(

Cool. I think basically it has to do with the compiler not implicitly casting 0 to a null pointer of whatever type - meaning it just sees it as integer zero. It may be related to the introduction of nullptr in C++0x, which MSVC++ 2010 supports. I don't know for sure, though.

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 28 guests