boost.filesystem create_directories throws std::bad_alloc

牧云@^-^@ 提交于 2019-12-01 18:04:33
Michael Burr

This problem smells like a mismatch in _SECURE_SCL (or maybe the somewhat related _HAS_ITERATOR_DEBUGGING - but I doubt the latter, since the call stack indicates a non-debug build). See https://stackoverflow.com/a/6104239/12711 for some info and make sure _SECURE_SCL is defined the same way in the builds for test.exe and the boost filesystem library linked in.

AFAIK, boost will use the VC default (which is _SECURE_SCL=1 even in release builds for VS2008), so if you're setting _SECURE_SCL=0 that may be the problem.

This seems to be a known bug in Microsoft's implementation of std::locale when running a DEBUG build. It was reported June 2012.

The message you get regarding memory address CDCDCDCE implies accessing deleted memory, as this bug describes.

There is no solution currently described in Microsoft's site, but I would suggest trying a different facet by changing L"c:\\foo\\bar" to "c:\\foo\\bar".

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