Error compiling CEGUIBase with Visual Studio 2010

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

Subsurf
Just popping in
Just popping in
Posts: 2
Joined: Sat May 15, 2010 18:31

Error compiling CEGUIBase with Visual Studio 2010

Postby Subsurf » Sat May 15, 2010 18:45

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?

agamemnus
Just can't stay away
Just can't stay away
Posts: 185
Joined: Sun Mar 14, 2010 04:21

Re: Error compiling CEGUIBase with Visual Studio 2010

Postby agamemnus » Sat May 15, 2010 20:49

Read this, and adjust accordingly, or download the latest SVN.. http://www.cegui.org.uk/wiki/index.php/ ... r_Irrlicht

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

Re: Error compiling CEGUIBase with Visual Studio 2010

Postby CrazyEddie » Sun May 16, 2010 08:08

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

Subsurf
Just popping in
Just popping in
Posts: 2
Joined: Sat May 15, 2010 18:31

Re: Error compiling CEGUIBase with Visual Studio 2010

Postby Subsurf » Sun May 23, 2010 11:36

Thanks! Works fine now


Return to “Help”

Who is online

Users browsing this forum: No registered users and 7 guests