2011-08-16 91 views
0

我想用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)" ([email protected][email protected]@[email protected]@[email protected]) already defined in cuda.obj 
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: unsigned short * __cdecl std::allocator<unsigned short>::allocate(unsigned __int64)" ([email protected][email protected]@[email protected]@[email protected]) already defined in cuda.obj 

cuda.obj使用nvcc編譯,但據我所知,我給NVCC確切相同的編譯器選項比其他文件相同。

我該怎麼做,這個錯誤從哪裏來?

回答

1

確保您使用相同的運行時庫,請檢查this answer瞭解如何設置項目。具體而言,請確保您對CUDA構建規則和標準C/C++構建(或/ MT)都使用/ MTd。