Error switching from vector<float> to vector<short>

99封情书 提交于 2019-12-12 04:45:09

问题


I have an app I'm making where I would like to change a vector I'm creating from float to short. My code is in a header file like this:

vector<float> vertices;

and it works fine, but if I switch it to this:

vector<short> vertices;

and compile, it crashes with the following error:

malloc: *** error for object 0x1035804: incorrect checksum for freed object
 - object was probably modified after being freed. *** set a breakpoint in
malloc_error_break to debug

I have no idea what's going on. If it helps, this is an OpenGL application I'm developing for the iPad.


回答1:


I still don't know why my app wouldn't run when I changed my vector from float to short, but I solved the problem by creating a new vector object of shorts and using that instead. No more problems and works as expected.



来源:https://stackoverflow.com/questions/5749735/error-switching-from-vectorfloat-to-vectorshort

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!