乘以定义的标准分配器

时间:2011-08-16 14:35:27

标签: c++ visual-studio-2008 cuda

我正在尝试使用VC ++ 2008编译C ++ DLL。我已经使用VC ++ 2010正确编译了它,但是使用VC ++ 2008,我收到以下错误:

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是使用nvcc编译的,但据我所知,我给nvcc提供了与其他文件完全相同的编译器选项。

我该怎么做,这个错误来自哪里?

1 个答案:

答案 0 :(得分:1)

确保使用相同的运行时库,请查看this answer以了解如何设置项目。具体来说,请确保对CUDA构建规则和标准C / C ++构建(或/ MT)使用/ MTd。

相关问题