0

I am trying to compile a C++ DLL with VC++2008. I already compiled it correctly with VC++2010, but with VC++2008, I get the following error:

1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: unsigned short * __cdecl std::allocator<unsigned short>::allocate(unsigned __int64)" (?allocate@?$allocator@G@std@@QEAAPEAG_K@Z) already defined in cuda.obj
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: unsigned short * __cdecl std::allocator<unsigned short>::allocate(unsigned __int64)" (?allocate@?$allocator@G@std@@QEAAPEAG_K@Z) already defined in cuda.obj

cuda.obj is compiled using nvcc, but as far as I can tell, I gave nvcc the exact same compiler options than for the other files.

What can I do, and where could this error come from?

PierreBdR
  • 42,120
  • 10
  • 46
  • 62

1 Answers1

1

Make sure that you use the same runtime library, check out this answer for how to set up the projects. Specifically, make sure you use /MTd for both the CUDA build rule and the standard C/C++ build (or /MT).

Community
  • 1
  • 1
Tom
  • 20,852
  • 4
  • 42
  • 54