All,
I keep trying some simple tutorials, but I keep running into linking errors. I am using VS Studio 2005 on XP x64. I start by generating a new static library project using the CUDA Wizard. I then add a win32 console project to the solution. I use the configuration manager to create 64 bit versions of both projects. I link in the static library. Everything compiles and links correctly at this point, and I see the correct output from the “Hello CUDA” program generated by the wizard.
As soon as I try to do something more complicated, I see the following errors:
1>LIBCMT.lib(setlocal.obj) : error LNK2005: _configthreadlocale already defined in MSVCRT.lib(MSVCR80.dll)
1>LIBCMT.lib(tidtable.obj) : error LNK2005: _encode_pointer already defined in MSVCRT.lib(MSVCR80.dll)
1>LIBCMT.lib(tidtable.obj) : error LNK2005: _decode_pointer already defined in MSVCRT.lib(MSVCR80.dll)
1>LIBCMT.lib(invarg.obj) : error LNK2005: _invalid_parameter_noinfo already defined in MSVCRT.lib(MSVCR80.dll)
1>LIBCMT.lib(lconv.obj) : error LNK2005: localeconv already defined in MSVCRT.lib(MSVCR80.dll)
1>LIBCMT.lib(trnsctrl.obj) : error LNK2005: __CxxFrameHandler3 already defined in MSVCRT.lib(MSVCR80.dll)
1>LIBCMT.lib(hooks.obj) : error LNK2005: “void __cdecl terminate(void)” (?terminate@@YAXXZ) already defined in MSVCRT.lib(MSVCR80.dll)
1>LIBCMT.lib(typinfo.obj) : error LNK2005: “public: void __cdecl type_info::_type_info_dtor_internal_method(void)” (?_type_info_dtor_internal_method@type_info@@QEAAXXZ) already defined in MSVCRT.lib(MSVCR80.dll)
1>LIBCMT.lib(typinfo.obj) : error LNK2005: “private: __cdecl type_info::type_info(class type_info const &)” (??0type_info@@AEAA@AEBV0@@Z) already defined in MSVCRT.lib(ti_inst.obj)
1>LIBCMT.lib(typinfo.obj) : error LNK2005: “private: class type_info & __cdecl type_info::operator=(class type_info const &)” (??4type_info@@AEAAAEAV0@AEBV0@@Z) already defined in MSVCRT.lib(ti_inst.obj)
1>LIBCMT.lib(_file.obj) : error LNK2005: __iob_func already defined in MSVCRT.lib(MSVCR80.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: _amsg_exit already defined in MSVCRT.lib(MSVCR80.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: _initterm_e already defined in MSVCRT.lib(MSVCR80.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: exit already defined in MSVCRT.lib(MSVCR80.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRT.lib(MSVCR80.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: _cexit already defined in MSVCRT.lib(MSVCR80.dll)
1>LIBCMT.lib(mlock.obj) : error LNK2005: _unlock already defined in MSVCRT.lib(MSVCR80.dll)
1>LIBCMT.lib(mlock.obj) : error LNK2005: _lock already defined in MSVCRT.lib(MSVCR80.dll)
1>LIBCMT.lib(winxfltr.obj) : error LNK2005: _XcptFilter already defined in MSVCRT.lib(MSVCR80.dll)
1>LIBCMT.lib(errmode.obj) : error LNK2005: __set_app_type already defined in MSVCRT.lib(MSVCR80.dll)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: __xi_a already defined in MSVCRT.lib(cinitexe.obj)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: __xi_z already defined in MSVCRT.lib(cinitexe.obj)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: __xc_a already defined in MSVCRT.lib(cinitexe.obj)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: __xc_z already defined in MSVCRT.lib(cinitexe.obj)
My searches indicate that this usually happens if you modify settings such that you are attempting to link both the threaded and non-threaded versions of the C runtime. I do not add any files, and I do not modify any compiler settings after successfully performing the “Hello CUDA” test. Unless something is being modified automatically, this does not seem likely.
After it happened the first time, I thought I might have messed something up. I started from scratch, and it happened again… Does anybody have any ideas why this is happening?
Thanks!