For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Link errors when building OCC 6.7.0 on Win7

Hugues Delorme's picture

Hello,

I'm getting errors when linking TKAdvTools.dll :

[ 6%] Built target TKernel
[ 9%] Built target TKMath
Linking CXX shared library ..\..\..\out\bin\TKAdvTools.dll
LIBCMT.lib(invarg.obj) : error LNK2005: _invalid_parameter already defined in MSVCRTD.lib(MSVCR110D.dll)
LIBCMT.lib(_file.obj) : error LNK2005: __iob_func already defined in MSVCRTD.lib(MSVCR110D.dll)
LIBCMT.lib(_file.obj) : error LNK2005: _lock_file already defined in MSVCRTD.lib(MSVCR110D.dll)
LIBCMT.lib(_file.obj) : error LNK2005: _unlock_file already defined in MSVCRTD.lib(MSVCR110D.dll)
LIBCMT.lib(mlock.obj) : error LNK2005: _lock already defined in MSVCRTD.lib(MSVCR110D.dll)
LIBCMT.lib(mlock.obj) : error LNK2005: _unlock already defined in MSVCRTD.lib(MSVCR110D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: _amsg_exit already defined in MSVCRTD.lib(MSVCR110D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: _initterm_e already defined in MSVCRTD.lib(MSVCR110D.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: exit already defined in MSVCRTD.lib(MSVCR110D.dll)
LIBCMT.lib(winapisupp.obj) : error LNK2005: __crtCaptureCurrentContext already defined in MSVCRTD.lib(MSVCR110D.dll)
LIBCMT.lib(winapisupp.obj) : error LNK2005: __crtCapturePreviousContext already defined in MSVCRTD.lib(MSVCR110D.dll)
LIBCMT.lib(winapisupp.obj) : error LNK2005: __crtTerminateProcess already defined in MSVCRTD.lib(MSVCR110D.dll)
LIBCMT.lib(winapisupp.obj) : error LNK2005: __crtUnhandledException already defined in MSVCRTD.lib(MSVCR110D.dll)
LIBCMT.lib(winxfltr.obj) : error LNK2005: __CppXcptFilter already defined in MSVCRTD.lib(MSVCR110D.dll)
LIBCMT.lib(fflush.obj) : error LNK2005: fflush already defined in MSVCRTD.lib(MSVCR110D.dll)
LIBCMT.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRTD.lib(MSVCR110D.dll)
LIBCMT.lib(crt0init.obj) : error LNK2005: __xi_a already defined in MSVCRTD.lib(cinitexe.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: __xi_z already defined in MSVCRTD.lib(cinitexe.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: __xc_a already defined in MSVCRTD.lib(cinitexe.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: __xc_z already defined in MSVCRTD.lib(cinitexe.obj)

LINK : warning LNK4098: conflict between default library 'MSVCRTD' and other libraries use /NODEFAULTLIB:library
LINK : warning LNK4098: conflict between default library 'LIBCMT' and other libraries use /NODEFAULTLIB:library

OS : Win7 Pro with last updates installed
OCC version : v6.7.0 with 3rdparty libraries for vc2012_x64 from "Download Center"
C++ compiler : Visual C++ 2012 x64 express edition
cmake version : 2.8.12.2

Any idea how to solve these errors ?

Attachments: 
Denis Barbier's picture

Hello,

See http://msdn.microsoft.com/en-us/library/abx4dbyh.aspx
You are mixing objects compiled with /MT and /MDd, this is not supported.

Hugues Delorme's picture

Thanks you Denis for your help,

These errors happen when building OCC in "Debug" configuration, I get no error with the "Release" configuration.

Within cmake-gui I leave untouched the compiler and linker flags, don't know where this /MT /MDd conflict comes from.