none
Conflict on the declaration of Vector4 between Vector.h and MSR_NuiApi.h, how to solve it ? RRS feed

  • Question

  • Hi everyone,

    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 ?

    Thanks for your help,

    Hugo Hache

    Friday, October 14, 2011 3:59 PM

All replies

  • 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.

    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.

    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


    I'm here to help
    Monday, October 17, 2011 7:34 AM