Vector.h和MSR_NuiApi.h之间的Vector4声明冲突,如何解决? [英] Conflict on the declaration of Vector4 between Vector.h and MSR_NuiApi.h, how to solve it ?

查看:97
本文介绍了Vector.h和MSR_NuiApi.h之间的Vector4声明冲突,如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在努力将使用OpenNi Kinect驱动程序构建的工具改编为SDK驱动程序。但是程序使用向量库,当我尝试编译我的代码时,Vector4的声明存在冲突(MSR_NuiApi.h也声明了Vector4)。
您是否有想法在没有调整向量或MSR_NuiApi文件的情况下解决它?

I'm currently working on adapting a tool built with OpenNi Kinect driver to the SDK driver. However the program uses the vector library, and when I try to compile my code there is a conflict on the declaration of Vector4 (MSR_NuiApi.h declares also Vector4). Do you have an idea to solve it without tempering the vector or MSR_NuiApi files ?

感谢您的帮助,

Hugo Hache

Hugo Hache

推荐答案

因此,Vector4的一个声明(A)来自MSR_NuiApi.h,另一个(B)定义在哪里?是你控制范围内的声明B?如果是这样,似乎更容易修改你的。

So, one declaration (A) of Vector4 is from MSR_NuiApi.h, where is the other one (B) defined? is declaration B within your control? if so, it seems like it would be easier to modify yours.

此外,声明A和B二进制兼容,还是它们不同?如果它们是兼容的,那么将#ifdef包裹在一个可以工作,即使不方便。

Also, are declarations A and B binary compatible, or are they different? if they are compatible, then wrapping a #ifdef around one could work, even if inconvenient.

如果它们根本无法混合和匹配,并且它们都在你的控制之外,那么你可能最好为最少使用的那个创建某种适应层,从而导致最少的代码更改。确保没有
源文件同时包含声明A和B,并且有一些类从一个声明中公开结构,确保只执行包装类(.cpp文件)而不是声明  ;包装器
类(.h文件)#include你要包装的声明。

If they simply can't be mixed and matched, and they are both outside of your control, then you might be better off creating some kind of adaptation layer for the one that is used least often and thus would result in least code changes. Make sure that no source file includes both declarations A and B simultaneously, and have some class that exposes the structures from one of the declarations, ensuring that only the implementation of the wrapper class (.cpp file) and not the declaration of the wrapper class (.h file) #includes the declaration you're trying to wrap.

重申:如果两个声明/定义中至少有一个在你的控制,那么你应该确保只使用一个相同名称的结构。否则你需要自己编写某种适配器。

Reiterating: if at least one of the two declarations/definitions is under your control, then you should make sure that only one structure of same name is ever used. Otherwise you need to write some kind of adapter yourself.

Eddy


这篇关于Vector.h和MSR_NuiApi.h之间的Vector4声明冲突,如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆