Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7220 Discussions

compile&link works in debug but not release?

mhovers
Beginner
841 Views

I am building a project using:

Microsoft Visual Studio 2005
Version 8.0.50727.762 (SP.050727-7600)
Microsoft .NET Framework
Version 2.0.50727

Installed Edition: Professional

Microsoft Visual C# 2005 77626-009-1998976-41170
Microsoft Visual C# 2005

Microsoft Visual C++ 2005 77626-009-1998976-41170
Microsoft Visual C++ 2005

Microsoft Visual J# 2005 77626-009-1998976-41170
Microsoft Visual J# 2005

Microsoft Visual Web Developer 2005 77626-009-1998976-41170
Microsoft Visual Web Developer 2005

Microsoft Web Application Projects 2005 77626-009-1998976-41170
Microsoft Web Application Projects 2005
Version 8.0.50727.762

Crystal Reports AAC60-G0CSA4B-V7000AY
Crystal Reports for Visual Studio 2005


Intel Fortran Compiler Integration
Intel Fortran Compiler Integration for Microsoft Visual Studio 2005, Version 10.0.3718.2005, Copyright (C) 2002-2007 Intel Corporation

Microsoft Visual Studio 2005 Professional Edition - ENU Service Pack 1 (KB926601)

I have a f90 master that links to a C library. The C library calls the MKL CBlas routines.

Under Debug it all compiles and links fine. When I go to build a Release version I get all of the following errors:

Linking...

Link /OUT:&quotReleasemare2d_v2.1_intel.exe

" /INCREMENTAL:NO /NOLOGO /LIBPATH:&quotC:Program FilesIntelMKL9.1ia32lib" /MANIFEST /MANIFESTFILE:&quotC:mhoversmare2d_v2.1_intel eleasemare2d_v2.1_intel.exe.intermediate.manifest" /SUBSYSTEM:CONSOLE mkl_c.lib &quotReleaseMARE2DCSEM.obj" &quotc:mhoversmare2d_v2.1_intel eleaseSuper_LU.lib"

Link: executing 'link'

Super_LU.lib(c_fortran_zgssv.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance

MSVCRT.lib(MSVCR80.dll) : error LNK2005: _sprintf already defined in LIBCMT.lib(sprintf.obj)

MSVCRT.lib(MSVCR80.dll) : error LNK2005: ___iob_func already defined in LIBCMT.lib(_file.obj)

MSVCRT.lib(MSVCR80.dll) : error LNK2005: _printf already defined in LIBCMT.lib(printf.obj)

MSVCRT.lib(MSVCR80.dll) : error LNK2005: _fprintf already defined in LIBCMT.lib(fprintf.obj)

MSVCRT.lib(MSVCR80.dll) : error LNK2005: _exit already defined in LIBCMT.lib(crt0dat.obj)

MSVCRT.lib(MSVCR80.dll) : error LNK2005: _free already defined in LIBCMT.lib(free.obj)

MSVCRT.lib(MSVCR80.dll) : error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj)

MSVCRT.lib(MSVCR80.dll) : error LNK2005: _calloc already defined in LIBCMT.lib(calloc.obj)

MSVCRT.lib(MSVCR80.dll) : error LNK2005: _fflush already defined in LIBCMT.lib(fflush.obj)

LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

Releasemare2d_v2.1_intel.exe : fatal error LNK1169: one or more multiply defined sy mbols found

It says to use /NODEFAULTLIB:library, but

1) where do I do this and

2) does library = LIBCMT.lib?

thanks

0 Kudos
4 Replies
Andrey_G_Intel2
Employee
841 Views

I think, you are trying to build you project as "multi-thread DLL" (/MD option). MKL libraries built as "multi-thread". And you have conflict of "multi-thread DLL" and "multi-thread" run-time libraries here.

Change value of this field "solution properties --> configuration properties --> C/C++ --> Code Generation --> Runtime library" to "multi-thread".

0 Kudos
mhovers
Beginner
841 Views

Thanks very much , that did it.

cheers

0 Kudos
mhovers
Beginner
841 Views

Now I have added the MPICH2 libraries and am getting:

Linking...

Link /OUT:&quotReleasemare2d_v3.exe

" /INCREMENTAL:NO /NOLOGO /LIBPATH:&quotC:Program FilesMPICH2lib" /LIBPATH:&quotC:Program FilesIntelMKL9.1ia32lib" /MANIFEST /MANIFESTFILE:&quotC:mhoversmare2d_v3 eleasemare2d_v3.exe.intermediate.manifest" /SUBSYSTEM:CONSOLE /STACK:250000000,250000000 fmpich2.lib mkl_c.lib &quotReleasemare2d_modules.obj" &quotReleaseMARE2DCSEM_V3_par.obj" &quotReleaseslave_server.obj" &quotReleasedipole1d.obj" &quotReleasempi_fe_forward.obj" &quotReleasewritesolution.obj" &quotReleasemare2d_input_file_scan.obj" &quotRelease eadsite.obj" &quotReleasecsem2dfw_mpi.obj" &quotReleaseallocate_local_arrays.obj" &quotReleasemaster_forward.obj" &quotRelease estconvergence.obj" &quotReleasefill_local_solmtx.obj" &quotRelease eadmesh.obj" &quotReleaseallocate_master_arrays.obj" &quotRelease eadwavenum.obj" &quotReleasedeallocate_local_arrays.obj" &quotReleasemesh_file_copy.obj" &quotReleaseupdatefilenames_mpi.obj" &quotReleaseintegratefilds_mpi.obj" &quotRelease eadrunfile.obj" &quotReleaseallocatecsem2dfw_mpi.obj" &quotc:mhoversmare2d_v3 eleaseSuperLU_SRC.lib"

Link: executing 'link'

SuperLU_SRC.lib(c_fortran_zgssv.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance

LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRT.lib(MSVCR80.dll)

LIBCMT.lib(setlocal.obj) : error LNK2005: __configthreadlocale already defined in MSVCRT.lib(MSVCR80.dll)

LIBCMT.lib(tidtable.obj) : err or LNK2005: __encode_pointer already defined in MSVCRT.lib(MSVCR80.dll)

LIBCMT.lib(tidtable.obj) : error LNK2005: __decode_pointer already defined in MSVCRT.lib(MSVCR80.dll)

LIBCMT.lib(printf.obj) : error LNK2005: _printf already defined in MSVCRT.lib(MSVCR80.dll)

LIBCMT.lib(_file.obj) : error LNK2005: ___iob_func already defined in MSVCRT.lib(MSVCR80.dll)

LIBCMT.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in MSVCRT.lib(MSVCR80.dll)

LIBCMT.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined in MSVCRT.lib(MSVCR80.dll)

LIBCMT.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRT.lib(MSVCR80.dll)

LIBCMT.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRT.lib(MSVCR80.dll)

LIBCMT.lib(crt0dat.obj) : error LNK2005: __cexit already defined in MSVCRT.lib(MSVCR80.dll)

LIBCMT.lib(mlock.obj) : error LNK2005: __unlock already defined in MSVCRT.lib(MSVCR80.dll)

LIBCMT.lib(mlock.obj) : error LNK2005: __lock already defined in MSVCRT.lib(MSVCR80.dll)

LIBCMT.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRT.lib(MSVCR80.dll)

LIBCMT.lib(calloc.obj) : error LNK2005: _calloc already defined in MSVCRT.lib(MSVCR80.dll)

LIBCMT.lib(crt0.obj) : error LNK2005: _mainCRTStartup already defined in MSVCRT.lib(crtexe.obj)

LIBCMT.lib(fflush.obj) : error LNK2005: _fflush already defined in MSVCRT.lib(MSVCR80.dll)

LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRT.lib(cinitexe.obj)

LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRT.lib(cinitexe.obj)

LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRT.lib(cinitexe.obj)

LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRT.lib(cinitexe.obj)

LIBCMT.lib(hooks.obj) : error LNK2005: &quotvoid __cdecl terminate(void)

" (?terminate@@YAXXZ) already defined in MSVCRT.lib(MSVCR80.dll)

LIBCMT.lib(errmode.obj) : error LNK2005: ___set_app_type already defined in MSVCRT.lib(MSVCR80.dll)

LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library

Releasemare2d_v3.exe : fatal error LNK1169: one or more multiply defined symbols found

mare2d_v3 - 24 error(s), 2 warning(s)

I have compiled the C library with /MT just as befor when it worked. Is this some incompatibility with the MPICH2 libraries?

thanks,

0 Kudos
Andrey_G_Intel2
Employee
841 Views
WhichMPICH libraries are you using? Maybe they have two variants MT and MD?
0 Kudos
Reply