I'm struggling a bit to understand the code sharing arrangement between BulletMultiThreaded, libbulletcuda, and the Gpu demos. I understand the idea of BT_GPU_PREF to make different access functions for Cpu and Gpu. But then the functions that these call are redefined wherever the ...SharedCode.h file is included.
In order to make this build for me, I took out btGpuDemo3dCpuFunc.cpp, and all reference to Cpu calls, forcing everything onto Gpu. This works.
Then I wanted to try btCudaBroadphase. When I enable this in the demo, I get conflicts with the definitions in libbulletcuda and BulletMultiThreaded:
Am I doing something wrong in the linking? I am fairly new to Cuda - is there some way that the compiler can distinguish between Gpu and Cpu functions with the same name?1> Generating Code...
1>BulletMultiThreaded.lib(btGpu3DGridBroadphase.obj) : error LNK2005: "void __cdecl calcHashAABBD(struct bt3DGrid3F1U *,struct uint2 *,unsigned int)" (?calcHashAABBD@@YAXPEAUbt3DGrid3F1U@@PEAUuint2@@I@Z) already defined in libbulletcuda_d.lib(btCudaBroadphase_cu.obj)
1>BulletMultiThreaded.lib(btGpu3DGridBroadphase.obj) : error LNK2005: "struct int3 __cdecl bt3DGrid_calcGridPos(struct float4)" (?bt3DGrid_calcGridPos@@YA?AUint3@@Ufloat4@@@Z) already defined in libbulletcuda_d.lib(btCudaBroadphase_cu.obj)
1>BulletMultiThreaded.lib(btGpu3DGridBroadphase.obj) : error LNK2005: "unsigned int __cdecl bt3DGrid_calcGridHash(struct int3)" (?bt3DGrid_calcGridHash@@YAIUint3@@@Z) already defined in libbulletcuda_d.lib(btCudaBroadphase_cu.obj)
1>BulletMultiThreaded.lib(btGpu3DGridBroadphase.obj) : error LNK2005: "void __cdecl findCellStartD(struct uint2 *,unsigned int *,unsigned int)" (?findCellStartD@@YAXPEAUuint2@@PEAII@Z) already defined in libbulletcuda_d.lib(btCudaBroadphase_cu.obj)
1>BulletMultiThreaded.lib(btGpu3DGridBroadphase.obj) : error LNK2005: "void __cdecl findOverlappingPairsD(struct bt3DGrid3F1U *,struct uint2 *,unsigned int *,unsigned int *,struct uint2 *,unsigned int)" (?findOverlappingPairsD@@YAXPEAUbt3DGrid3F1U@@PEAUuint2@@PEAI21I@Z) already defined in libbulletcuda_d.lib(btCudaBroadphase_cu.obj)
1>BulletMultiThreaded.lib(btGpu3DGridBroadphase.obj) : error LNK2005: "void __cdecl findPairsInCell(struct int3,unsigned int,struct uint2 *,unsigned int *,struct bt3DGrid3F1U *,unsigned int *,struct uint2 *,unsigned int)" (?findPairsInCell@@YAXUint3@@IPEAUuint2@@PEAIPEAUbt3DGrid3F1U@@21I@Z) already defined in libbulletcuda_d.lib(btCudaBroadphase_cu.obj)
1>BulletMultiThreaded.lib(btGpu3DGridBroadphase.obj) : error LNK2005: "unsigned int __cdecl cudaTestAABBOverlap(struct bt3DGrid3F1U,struct bt3DGrid3F1U,struct bt3DGrid3F1U,struct bt3DGrid3F1U)" (?cudaTestAABBOverlap@@YAIUbt3DGrid3F1U@@000@Z) already defined in libbulletcuda_d.lib(btCudaBroadphase_cu.obj)
1>BulletMultiThreaded.lib(btGpu3DGridBroadphase.obj) : error LNK2005: "void __cdecl findPairsLargeD(struct bt3DGrid3F1U *,struct uint2 *,unsigned int *,unsigned int *,struct uint2 *,unsigned int,unsigned int)" (?findPairsLargeD@@YAXPEAUbt3DGrid3F1U@@PEAUuint2@@PEAI21II@Z) already defined in libbulletcuda_d.lib(btCudaBroadphase_cu.obj)
1>BulletMultiThreaded.lib(btGpu3DGridBroadphase.obj) : error LNK2005: "void __cdecl computePairCacheChangesD(unsigned int *,struct uint2 *,unsigned int *,struct bt3DGrid3F1U *,unsigned int)" (?computePairCacheChangesD@@YAXPEAIPEAUuint2@@0PEAUbt3DGrid3F1U@@I@Z) already defined in libbulletcuda_d.lib(btCudaBroadphase_cu.obj)
1>BulletMultiThreaded.lib(btGpu3DGridBroadphase.obj) : error LNK2005: "void __cdecl squeezeOverlappingPairBuffD(unsigned int *,struct uint2 *,unsigned int *,unsigned int *,struct bt3DGrid3F1U *,unsigned int)" (?squeezeOverlappingPairBuffD@@YAXPEAIPEAUuint2@@00PEAUbt3DGrid3F1U@@I@Z) already defined in libbulletcuda_d.lib(btCudaBroadphase_cu.obj)
1>C:\Users\tim\bullet-2.78\Demos\Gpu3dDemo\Debug\AppGpu3dDemo.exe : fatal error LNK1169: one or more multiply defined symbols found
I am building on windows 7 64bit, and MSVC10, nvcc4. Any ideas?
Thanks,
Tim