乘以定义的标准分配器
Multiply defined standard allocator
我正在尝试用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与其他文件完全相同的编译器选项。
我能做什么,这个错误可能来自哪里?
确保您使用相同的运行时库,查看如何设置项目的答案。具体来说,确保您使用/MTd用于CUDA构建规则和标准C/c++构建(或/MT)。
相关文章:
- 当有分配器意识的容器被复制/移动时,反弹分配器是否被复制/移走
- 将 std::allocate_shared 与多态资源分配器一起使用
- 尝试将lambda函数放在队列中时出现一般分配器错误(可能是与unique_ptr有关的错误)
- C++17 - 使用自定义分配器的节点提取/重新插入 - 适用于 clang++/libc++,但不适用于 libstd
- 使用 std::分配器在 constexpr 中进行默认初始化
- 使用不兼容的分配器复制分配无序列图
- C++:矢量分配器行为、内存分配和智能指针
- 是否可以使用分配器对象来释放另一个分配器分配的内存?
- 使用模板化分配器和对向量进行排序的函数
- C++ 中的分配器错误
- 基于浅树的数据结构的内存分配器,用于频繁分配和解除分配
- 通过引用传递向量是请求 std::分配器
- 为什么这个分配器不适用于"std::allocate_shared"?奇怪的模板替换错误
- 为什么 std::vector 使用 std::分配器而不是运算符 new 和 delete?
- C++自定义分配器大小参数作为模板参数会引发编译器错误
- 在分配器中销毁元素时,C++会导致双重释放<string>?
- C++17 和更新的 std::分配器是否适用于动态数量的自定义堆?
- c++ 中的自定义分配器,用于不调用secure_string实现
- 是否允许分配器构造和销毁成员函数从内部逻辑引发异常?
- 我可以对 std::array 使用自定义分配器来获取安全加密密钥吗?