Maya Plug-in conflicts with CUDA Namespace conflict between <vector>

Hello,

I’m trying to implement a Maya Plug-in (Maya 2011 64-bit) that uses CUDA (64-bit) but fail to compile since both <vector_types.h> from CUDA and <MTypes.h> from MAYA define datatypes with the same label.

I get 22 errors like these in Visual Studio 2008.

1>c:\program files\nvidia gpu computing toolkit\cuda\v3.2\include\vector_types.h(136) : error C2371: 'short2' : redefinition; different basic types

1>        ..\Dependencies\include\maya/MTypes.h(245) : see declaration of 'short2'

1>c:\program files\nvidia gpu computing toolkit\cuda\v3.2\include\vector_types.h(148) : error C2371: 'short3' : redefinition; different basic types

1>        ..\Dependencies\include\maya/MTypes.h(246) : see declaration of 'short3'

1>c:\program files\nvidia gpu computing toolkit\cuda\v3.2\include\vector_types.h(177) : error C2371: 'int2' : redefinition; different basic types

1>        ..\Dependencies\include\maya/MTypes.h(249) : see declaration of 'int2'

1>c:\program files\nvidia gpu computing toolkit\cuda\v3.2\include\vector_types.h(184) : error C2371: 'int3' : redefinition; different basic types

1>        ..\Dependencies\include\maya/MTypes.h(250) : see declaration of 'int3'

...

The problem I have is the same as the one in the following link (in french) but there’s no answer here:

http://www.developpez.net/forums/d793206/c-cpp/cpp/conflit-types-entre-fichiers-sdk-differents-fatal-error-c2371/

I run Windows 7 64-bit and target to x64 platform but most probably that’s not relevant to the problem.

Has anyone found the same problem? How have you solved it?

Thanks in advance,

Nicolau Sunyer

University of Girona (Spain)

Hi,

I am not sure it can work, but try to include one of your include file in a namespace

namespace cuda

{

#include <vector_types.h>

}

hopefully your cuda vector should become cuda::short2 and the maya vector ::short2

Why Cuda does not have a namespace ? Especially when naming types with really basic names like uint, float3 ? Indeed it is quite boring…

edit: no namespace in C, arf. So why no namespace in C ? :)

–pium

Yes, it works!

Thanks a lot for your help. It’s indeed a bit weird. But this way it works.

:thanks:

Nicolau

Hello Friends, I also I have the same problem, but no solution as Pium apply if you can explain a little better how to apply the solution, I am new to this :). In the only file I have vector_types.h, is in “sutilCommonDefines.h” which is optix 2.0. But not if one has called this by another. Thanks in advance