Typedef redefinition (C2371) for uint32 in two 3rd-party libraries

限于喜欢 提交于 2019-12-05 21:09:31

You can do this hack:

#define uint32 Box2D_uint32
#include "Box2D.h"
#undef uint32
#define uint32 Spider_uint32
#include "Spidermonkey.h"
#undef uint32

Since typedef is merely an alias, this shouldn't cause ODR violation as long as these headers contain declarations only. If there is a (struct or inline function) definition that uses uint32, it will violate ODR. Although your compiler probably isn't smart enough to detect this and it still will work.

But a better choice is to report the problem to the library developers so they will fix that with, e.g. namespaces.

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