Hi, I'm wondering if anyone call help me I'm trying to use bullet in my honours year project and I'm getting the following errors with this code.
class Cell
{
private:
.....loads of irrelevent stuff
btCollisionObject colObj;
}
class Map
{
...more irrelevence
vector<vector<Cell>> mapSpace; //so I can have a 2D Plane that can expand
}
vector(694) : error C2719: '_Val': formal parameter with __declspec(align('16')) won't be aligned
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include\vector(1076) : see reference to class template instantiation 'std::vector<_Ty>' being compiled
with
[
_Ty=Cell
]
..\Map.h(174) : see reference to class template instantiation 'std::vector<_Ty>' being compiled
1> with
1> [
1> _Ty=std::vector<Cell>
1> ]
I know the error is with the class btCollisionObject being defined as: ATTRIBUTE_ALIGNED16(class) but I don't know how to fix it. I don't want to go in and start hacking up code that works incase I cause serious damage and forget what I changed. So any help?
std::vector errors
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: std::vector errors
Bullet provides btAlignedObjectArray, which has a very similar interface/usage to STL std::vector. It deals properly with alignment.
Hope this helps,
Erwin
Hope this helps,
Erwin
-
- Posts: 1
- Joined: Mon Feb 18, 2008 9:35 pm
Re: std::vector errors
There is an easy workaround to this problem but you have to change <vector> header.
As i recall the method that requires modification is
void resize(size_type _Newsize, _Ty _Val)
just change it to
void resize(size_type _Newsize, const _Ty& _Val)
and all should compile, at least it worked for me when i was writing my sse code.
Although maybe you should provide a custom allocator that uses aligned_alloc instead of new
As i recall the method that requires modification is
void resize(size_type _Newsize, _Ty _Val)
just change it to
void resize(size_type _Newsize, const _Ty& _Val)
and all should compile, at least it worked for me when i was writing my sse code.
Although maybe you should provide a custom allocator that uses aligned_alloc instead of new