Page 1 of 1

Error compiling CEGUIBase with Visual Studio 2010

Posted: Sat May 15, 2010 18:45
by Subsurf
Hi all,

I wanted to use the newest CEGUI together with Ogre so I had to compile it myself.

I followed the steps in the Ogre-wiki (since there is no batch-file for creating a VC2010-project, i had to take the VC2008-project and let Visual Studio 2010 convert it, but that worked fine), but when I tried to compile the project, I got the following errors creating CEGUIBase:

Code: Select all

1>ClCompile:
1>  CEGUIMultiColumnList.cpp
1>p:\programs\microsoft visual studio 10.0\vc\include\xmemory(208): error C2440: 'Initialization': Can't convert 'int' to 'CEGUI::ListboxItem *'
1>          The conversion of an integer type to a pointer type requires a reinterpret_cast operator or a cast in C- or function-format.
1>          p:\programs\microsoft visual studio 10.0\vc\include\xmemory(280): See the reference to the instantiation of the currently compiled function template "void std::allocator<_Ty>::construct<int>(CEGUI::ListboxItem **,_Other &&)".
1>          with
1>          [
1>              _Ty=CEGUI::ListboxItem *,
1>              _Other=int
1>          ]
1>          p:\programs\microsoft visual studio 10.0\vc\include\vector(668): See the reference to the instantiation of the currently compiled function template "void std::_Cons_val<std::allocator<_Ty>,CEGUI::ListboxItem*,int>(_Alloc &,_Ty1 *,_Ty2 &&)".
1>          with
1>          [
1>              _Ty=CEGUI::ListboxItem *,
1>              _Alloc=std::allocator<CEGUI::ListboxItem *>,
1>              _Ty1=CEGUI::ListboxItem *,
1>              _Ty2=int
1>          ]
1>          p:\programs\microsoft visual studio 10.0\vc\include\vector(688): See the reference to the instantiation of the currently compiled function template "void std::vector<_Ty>::emplace_back<int>(_Valty &&)".
1>          with
1>          [
1>              _Ty=CEGUI::ListboxItem *,
1>              _Valty=int
1>          ]
1>          p:\programs\microsoft visual studio 10.0\vc\include\vector(675): See the reference to the instantiation of the currently compiled function template "std::_Vector_iterator<_Myvec> std::vector<_Ty>::emplace<int>(std::_Vector_const_iterator<_Myvec>,_Valty &&)".
1>          with
1>          [
1>              _Myvec=std::_Vector_val<CEGUI::ListboxItem *,std::allocator<CEGUI::ListboxItem *>>,
1>              _Ty=CEGUI::ListboxItem *,
1>              _Valty=int
1>          ]
1>          c:\cegui-0.7.1\cegui\src\elements\ceguimulticolumnlist.cpp(702): See the reference to the instantiation of the currently compiled function template "std::_Vector_iterator<_Myvec> std::vector<_Ty>::insert<int>(std::_Vector_const_iterator<_Myvec>,_Valty &&)".
1>          with
1>          [
1>              _Myvec=std::_Vector_val<CEGUI::ListboxItem *,std::allocator<CEGUI::ListboxItem *>>,
1>              _Ty=CEGUI::ListboxItem *,
1>              _Valty=int
1>          ]


How do I solve that? Is that a VS2010-specific problem?

Re: Error compiling CEGUIBase with Visual Studio 2010

Posted: Sat May 15, 2010 20:49
by agamemnus
Read this, and adjust accordingly, or download the latest SVN.. http://www.cegui.org.uk/wiki/index.php/ ... r_Irrlicht

Re: Error compiling CEGUIBase with Visual Studio 2010

Posted: Sun May 16, 2010 08:08
by CrazyEddie
Yes, this is a known issue with existing releases and the MSVC++ 2010 compiler, and has been discussed previously along with a couple of fixes. The stable branch code and the snapshot releases have been fixed (as well as svn trunk).

If you want to continue with 0.7.1 anyway, the fix is as follows:

Code: Select all

Index: CEGUIMultiColumnList.cpp
===================================================================
--- CEGUIMultiColumnList.cpp   (revision 2376)
+++ CEGUIMultiColumnList.cpp   (revision 2377)
@@ -699,7 +699,9 @@
    // Insert a blank entry at the appropriate position in each row.
    for (uint i = 0; i < getRowCount(); ++i)
    {
-      d_grid[i].d_items.insert(d_grid[i].d_items.begin() + position, 0);
+        d_grid[i].d_items.insert(
+            d_grid[i].d_items.begin() + position,
+            static_cast<ListboxItem*>(0));
    }
 
    // update stored nominated selection column if that has changed.


CE

Re: Error compiling CEGUIBase with Visual Studio 2010

Posted: Sun May 23, 2010 11:36
by Subsurf
Thanks! Works fine now