Reputation: 101
I'm trying to compile a Maya 2014 plugin using CUDA v5.5 (in VS2010), and if I try to include both CUDA (specifically vector_types.h), I get errors that stem from the fact that both Maya and CUDA define the same types:
C:\program files\nvidia gpu computing toolkit\cuda\v5.5\include\vector_types.h(148): error C2371: 'short2' : redefinition; different basic types
C:\Program Files\Autodesk\Maya2014\include\maya/MTypes.h(269) : see declaration of 'short2'
I'm not exactly sure how to fix this. Any thoughts?
Thanks!
Upvotes: 1
Views: 446
Reputation: 15734
Edit:
I looked into the idea of wrapping the include in a namespace and found that it does not work well. The problem is that the namespace is included in the mangled name, so you get undefined symbols when linking.
The only workable way I found (except for modifying one of the libraries) is to create a separate source file, include the conflicting file only there and create wrappers for the conflicting types and functions.
Wrapping one #include
in a namespace might work...
namespace maya
{
#include "maya.h"
};
Then, reference the symbols from maya.h
via the namespace:
maya::some_maya_symbol
.
Upvotes: 3