Cuda with C++.Net

Hi,

I’m new with Cuda and have been using it for about a month now.
My programs are working fine with Win32 Console Application but when I’m trying to use C++.Net and Windows Forms, I have compilation errors :

1>LIBCMT.lib(stdexcpt.obj) : error LNK2005: “public: __thiscall std::exception::exception(class std::exception const &)” (??0exception@std@@QAE@ABV01@@Z) déjà défini(e) dans MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(stdexcpt.obj) : error LNK2005: "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ) déjà défini(e) dans MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(tidtable.obj) : error LNK2005: __encode_pointer déjà défini(e) dans MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(tidtable.obj) : error LNK2005: __decode_pointer déjà défini(e) dans MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(hooks.obj) : error LNK2005: “void __cdecl terminate(void)” (?terminate@@YAXXZ) déjà défini(e) dans MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(typinfo.obj) : error LNK2005: “public: void __thiscall type_info::_type_info_dtor_internal_method(void)” (?_type_info_dtor_internal_method@type_info@@QAEXXZ) déjà défini(e) dans MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(typinfo.obj) : error LNK2005: “private: __thiscall type_info::type_info(class type_info const &)” (??0type_info@@AAE@ABV0@@Z) déjà défini(e) dans MSVCRTD.lib(ti_inst.obj)
1>LIBCMT.lib(typinfo.obj) : error LNK2005: “private: class type_info & __thiscall type_info::operator=(class type_info const &)” (??4type_info@@AAEAAV0@ABV0@@Z) déjà défini(e) dans MSVCRTD.lib(ti_inst.obj)
1>LIBCMT.lib(mlock.obj) : error LNK2005: __unlock déjà défini(e) dans MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(mlock.obj) : error LNK2005: __lock déjà défini(e) dans MSVCRTD.lib(MSVCR90D.dll)
1>LINK : warning LNK4098: conflit entre la bibliothèque par défaut ‘MSVCRTD’ et les autres bibliothèques ; utilisez /NODEFAULTLIB:library
1>libcpmt.lib(xlock.obj) : error LNK2005: “public: __thiscall std::_Lockit::_Lockit(int)” (??0_Lockit@std@@QAE@H@Z) déjà défini(e) dans msvcprtd.lib(MSVCP90D.dll)
1>libcpmt.lib(xlock.obj) : error LNK2005: “public: __thiscall std::_Lockit::~_Lockit(void)” (??1_Lockit@std@@QAE@XZ) déjà défini(e) dans msvcprtd.lib(MSVCP90D.dll)

Does anyone have any idea on a possible solution?

I also did look over GASS Cuda.NET but it seems that it only works with C#.

I’m developping in C++ with Visual Studio 2008.

Thanks.

Probably have to wait for the /MD cudart.dll, which should be out with CUDA 2.2.

Hi,

thanks for your answer.
As for now, I’ll try to use my cuda functions in a dll as a backup solution.

Hope Cuda 2.2 will be released soon.

The GASS .NET solution should work for you, if you’re compiling to managed C++. If you’re using the native compiler (as is required for use with the ‘normal’ CUDA methods) then it won’t.

But like tmurray said…depending on how you’re linking the CUDA libraries into your program, you may need to wait for CUDA 2.2 and the /MD CUDA runtime.

Indeed, I’m using the native compiler so it doesn’t work.
However, I could make it work throught a dll so that’s fine enough for now.

Thanks.