Link error of TKSevice using MTd Runtime library in win64 + debug + win8 + OCC6.7.1

Hi All,
I am transfering my OCC 6.5.3 to OCC6.7.1. Since my main app is using MTd (multi-threaded debug) runtime library, so I change all run times library (default MDd) of OCC6.7.1 to MTd. All modules are compiled well but the TKSevice. It always report link error of runtime library conflicts. The error information lists as follows:

1>------ Build started: Project: TKService, Configuration: Debug x64 ------
1>Build started 7/11/2014 11:28:34 AM.
1>InitializeBuildStatus:
1> Touching ".\..\..\..\win64\vc10\objd\TKService\TKService.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1> All outputs are up-to-date.
1>ResourceCompile:
1> All outputs are up-to-date.
1>libcmt.lib(invarg.obj) : error LNK2005: _initp_misc_invarg already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: _call_reportfault already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: _set_invalid_parameter_handler already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: _get_invalid_parameter_handler already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: _invoke_watson already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: "void __cdecl _invoke_watson(unsigned short const *,unsigned short const *,unsigned short const *,unsigned int,unsigned __int64)" (?_invoke_watson@@YAXPEBG00I_K@Z) already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: _invalid_parameter already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: "void __cdecl _invalid_parameter(unsigned short const *,unsigned short const *,unsigned short const *,unsigned int,unsigned __int64)" (?_invalid_parameter@@YAXPEBG00I_K@Z) already defined in LIBCMTD.lib(invarg.obj)
1>libcmt.lib(invarg.obj) : error LNK2005: __pInvalidArgHandler already defined in LIBCMTD.lib(invarg.obj)
1> Creating library ..\..\..\win64\vc10\libd\TKService.lib and object ..\..\..\win64\vc10\libd\TKService.exp
1>libcpmtd.lib(xdebug.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>.\..\..\..\win64\vc10\bind\TKService.dll : fatal error LNK1169: one or more multiply defined symbols found

---------------------------------------------------------------

In fact, I have changed FreeImage and FreeType to MTd compiled. But it did't help it.

The head of custome.bat is listed as follows:

set VCVER=vc10
set ARCH=64
set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
set "PRODUCTS_PATH=C:\OCC6.7.1"

rem Optional 3rd-parties switches
set HAVE_FREEIMAGE=false
set HAVE_GL2PS=false
set HAVE_TBB=false
set HAVE_OPENCL=false
set CHECK_QT4=false
set CHECK_JDK=false
-------------------------------------
Any information is welcome. Thanks in advance.

Ding

Timo Roth's picture

Maybe this helps: http://www.opencascade.org/org/forum/thread_26009/?forum=4

By the way, which version of freetype do you use? I was able to compile but had exceptions when debugging OCC when I used freetype 2.4.11. After changing to 2.5.3 it worked fine.

Cauchy Ding's picture

Hi Timo,

Thanks for your reply. In fact, I have changed all MDd to MTd, I did the similar changes in OCC6.3, OCC6.5.1 and OCC 6.5.3. But when I did the similar changes, I got this link error only happened in TKService module. It's strange. Anyway, thanks again for your reply.

Ding