Trying to get CEGUI compiling under VC10 but not having much luck. I know this won't be officially supported, but I figured someone might have a fix anyway.
The one place the build fails for me is in CEGUIMultiColumnList:
1> CEGUIMultiColumnList.cpp
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xmemory(205): 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
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xmemory(288) : see reference to function template instantiation 'void std::allocator<_Ty>::construct<int>(CEGUI::ListboxItem **,_Other &&)' being compiled
1> with
1> [
1> _Ty=CEGUI::ListboxItem *,
1> _Other=int
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\vector(659) : see reference to function template instantiation 'void std::_Cons_val<std::allocator<_Ty>,CEGUI::ListboxItem*,int>(_Alloc &,_Ty1 *,_Ty2 &&)' being compiled
1> with
1> [
1> _Ty=CEGUI::ListboxItem *,
1> _Alloc=std::allocator<CEGUI::ListboxItem *>,
1> _Ty1=CEGUI::ListboxItem *,
1> _Ty2=int
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\vector(679) : see reference to function template instantiation 'void std::vector<_Ty>::emplace_back<int>(_Valty &&)' being compiled
1> with
1> [
1> _Ty=CEGUI::ListboxItem *,
1> _Valty=int
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\vector(666) : see reference to function template instantiation 'std::_Vector_iterator<_Myvec> std::vector<_Ty>::emplace<int>(std::_Vector_const_iterator<_Myvec>,_Valty &&)' being compiled
1> with
1> [
1> _Myvec=std::_Vector_val<CEGUI::ListboxItem *,std::allocator<CEGUI::ListboxItem *>>,
1> _Ty=CEGUI::ListboxItem *,
1> _Valty=int
1> ]
1> c:\users\administrator\documents\visual studio 10\projects\cegui-0.6.2\src\elements\ceguimulticolumnlist.cpp(702) : see reference to function template instantiation 'std::_Vector_iterator<_Myvec> std::vector<_Ty>::insert<int>(std::_Vector_const_iterator<_Myvec>,_Valty &&)' being compiled
1> with
1> [
1> _Myvec=std::_Vector_val<CEGUI::ListboxItem *,std::allocator<CEGUI::ListboxItem *>>,
1> _Ty=CEGUI::ListboxItem *,
1> _Valty=int
1> ]
1> CEGUIMenuItem.cpp
Here's the structure definition that contains the offending vector:
struct ListRow
{
typedef std::vector<ListboxItem*> RowItems;
RowItems d_items;
uint d_sortColumn;
uint d_rowID;
// operators
ListboxItem* const& operator[](uint idx) const {return d_items[idx];}
ListboxItem*& operator[](uint idx) {return d_items[idx];}
bool operator<(const ListRow& rhs) const;
bool operator>(const ListRow& rhs) const;
};
Here's the function that fails in the STL:
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));
}
#endif /* _HAS_RVALUE_REFERENCES */
This seems to be the only point of failure, but I don't know much about the new rvalue reference stuff so I was wondering if anyone knew of a way to fix this.
Thanks.
Problem Compiling CEGUI Under VC10
Moderators: CEGUI MVP, CEGUI Team
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Problem Compiling CEGUI Under VC10
I tried to get this error here on g++. I got the error in relation to something in an Ogre header, but not from the CEGUI code.
Looking at it, it seems likely that it's taking a zero as an integer rather than as a null pointer, if that is the case, the fix will involve casting the 0 to ListboxItem*. From a cursory look, it could be the initialisation lines at 811 and 875 in CEGUIMultiColumnList.cpp - not 100% certain though.
HTH
CE.
Looking at it, it seems likely that it's taking a zero as an integer rather than as a null pointer, if that is the case, the fix will involve casting the 0 to ListboxItem*. From a cursory look, it could be the initialisation lines at 811 and 875 in CEGUIMultiColumnList.cpp - not 100% certain though.
HTH
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Problem Compiling CEGUI Under VC10
Gave it a try but it's still not taking unfortunately.
row.d_items.resize(getColumnCount(), static_cast<ListboxItem*>(0));
Made the modification to both lines but to no avail.
Thanks for the try though, appreciated. Can you think of anything else that might cause it?
row.d_items.resize(getColumnCount(), static_cast<ListboxItem*>(0));
Made the modification to both lines but to no avail.
Thanks for the try though, appreciated. Can you think of anything else that might cause it?
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Problem Compiling CEGUI Under VC10
Hmm. Can't think of anything else, if fact I'd say that's almost certainly the cause - but perhaps the fix was in the wrong place When you click the error in the IDE where does it take you in the source?
CE
CE
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Problem Compiling CEGUI Under VC10
CrazyEddie wrote:Hmm. Can't think of anything else, if fact I'd say that's almost certainly the cause - but perhaps the fix was in the wrong place When you click the error in the IDE where does it take you in the source?
CE
To the STL headers unfortunately. Lol.
The actual source of the error message is in the STL headers not your code.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Problem Compiling CEGUI Under VC10
Yeah, that's 'cos they're templates. I'll maybe do some digging later today and see what I can come up with.
CE.
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Problem Compiling CEGUI Under VC10
I had this very same problem around 15 minutes ago, and I found the error to be at line 702 of CEGUIMultiColumnList.cpp.
is to be changed to
In visual studio 2010 (when adapting new c++ standard) they killed some emerging problems by adding a new keyword to represent a pointer that points nowhere "nullptr" instead of using an integer "0". It shouldn't matter if you mix your own code with that "0" and nullptr, but when using STL containers you should stick to "nullptr" from now on.
For more information, refer to http://en.wikipedia.org/wiki/C%2B%2B0x#Null_pointer_constant or http://msdn.microsoft.com/en-us/library/4ex65770(VS.100).aspx
Code: Select all
d_grid[i].d_items.insert(d_grid[i].d_items.begin() + position, 0);
is to be changed to
Code: Select all
d_grid[i].d_items.insert(d_grid[i].d_items.begin() + position, nullptr);
In visual studio 2010 (when adapting new c++ standard) they killed some emerging problems by adding a new keyword to represent a pointer that points nowhere "nullptr" instead of using an integer "0". It shouldn't matter if you mix your own code with that "0" and nullptr, but when using STL containers you should stick to "nullptr" from now on.
For more information, refer to http://en.wikipedia.org/wiki/C%2B%2B0x#Null_pointer_constant or http://msdn.microsoft.com/en-us/library/4ex65770(VS.100).aspx
- scriptkid
- Home away from home
- Posts: 1178
- Joined: Wed Jan 12, 2005 12:06
- Location: The Hague, The Netherlands
- Contact:
Re: Problem Compiling CEGUI Under VC10
Hi,
Thanks for sharing this! It seems that they have made things much even more tight this round.
Thanks for sharing this! It seems that they have made things much even more tight this round.
Check out my released snake game using Cegui!
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Problem Compiling CEGUI Under VC10
Yeah, indeed. Thanks for the solution here. Slight PITA from a backwards compatibility point of view I think, but should be workable.
CE.
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Who is online
Users browsing this forum: No registered users and 4 guests