开发者

Multiply defined standard allocator

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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜