- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there! I'm test building a C++20 project and I ran into a linker error after upgrading the Windows SDK from version 10.0.22621.0 to 10.0.26100.0. The description given by the linker on VS2022 (17.10.3) is "Severity Code Description Project File Line Suppression State Details
Error LNK2005 frexp already defined in libmmt.lib(frexp_iface_c99.obj) NNExtended D:\NNetworks\Fashion-MNIST\NNExtended\libucrtd.lib(frexp.obj) : 1 ". When you examine the linker's logs you can see
Found _decomp
Referenced in libucrtd.lib(fpexcept.obj)
Loaded libucrtd.lib(frexp.obj)
libucrtd.lib(frexp.obj) : : error LNK2005: frexp already defined in libmmt.lib(frexp_iface_c99.obj)
I think the error happens because the symbol frexp is defined in MSVC's static debug library libucrtd.lib and Intel's static library libmmt.lib!
frexp is indeed in the symbols exported by Intel's libmmt.lib
PS D:\> dumpbin.exe /symbols "C:\Program Files (x86)\Intel\oneAPI\compiler\latest\lib\libmmt.lib" | Select-String "frexp"
008 00000000 SECT4 notype () External | __frexpq
frexpq.c
008 00000000 SECT4 notype () External | frexpf16
010 00000000 UNDEF notype External | frexpf
00B 00000000 SECT5 notype () External | __libm_frexpl_ex
frexpl.c
008 00000000 SECT4 notype () External | __libm_frexpf_ex
frexpf.c
008 00000000 SECT4 notype () External | __libm_frexp_e7
frexp_ct.c
00B 00000000 SECT5 notype () External | __libm_frexp_ex
frexp_gen.c
03C 00000000 UNDEF notype External | __libm_frexpl
050 00000000 SECT1C notype () External | __bwr_frexpf
0AE 00000000 UNDEF notype External | __libm_frexpf_ex
00B 00000000 SECT5 notype () External | __bwr_frexp
frexp_bwr.c
008 00000000 SECT4 notype () External | frexpl
010 00000000 UNDEF notype External | __libm_frexpl_ex
008 00000000 SECT4 notype () External | __libm_frexpl
010 00000000 UNDEF notype External | __libm_frexpl_ex
008 00000000 SECT4 notype () External | frexpf
00C 00000000 UNDEF notype External | __libm_frexpf_ex
008 00000000 SECT4 notype () External | __libm_frexpf
00C 00000000 UNDEF notype External | __libm_frexpf_ex
008 00000000 SECT4 notype () External | frexp
00C 00000000 UNDEF notype External | __libm_frexp_chosen_core_func_icx
008 00000000 SECT4 notype () Static | __libm_frexp_dispatch_table_icx_init_icx
00D 00000000 SECT5 notype () External | __libm_frexp
017 00000000 SECT6 notype Static | __libm_frexp_dispatch_table_icx
018 00000000 SECT2 notype External | __libm_frexp_chosen_core_func_icx
019 00000000 UNDEF notype External | __libm_frexp_ex
01A 00000000 UNDEF notype External | __libm_frexp_e7
and symbols exported by libucrtd.lib
PS D:\> dumpbin.exe /symbols "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.26100.0\ucrt\x64\libucrtd.lib" | Select-String "frexp"
11B 00000000 SECT59 notype External | ??_C@_05GKKHEGJL@frexp@ (`string')
04A 00000000 SECT19 notype () External | frexp
059 00000000 SECT1D notype Static | $unwind$frexp
05C 00000000 SECT1E notype Static | $pdata$frexp
I get no compilation errors with Visual C++ compiler! This happens only with Intel's C++ compiler (2024.2.0.491). The compiler flags in this configuration are
/MP /GS /TP /Wall /QxCOMMON-AVX512 /Gy /Zc:wchar_t /guard:cf /Zi /Od /debug:full /Ob0 /fp:precise /D "_DEBUG" /D "_CONSOLE" /D "__TEST__" /D "__INTEL_LLVM_COMPILER=20240200" /D "_UNICODE" /D "UNICODE" /fp:except /Zc:forScope /std:c17 /GR- /arch:AVX512 /MTd /QaxCOMMON-AVX512 /std:c++20 /Fa".\bin\Test\" /EHa /nologo /Fo".\bin\Test\" /Qstd=c++2a /Ot
and the linker options are
/OUT:".\bin\Test\NNExtended.exe" /MANIFEST /NXCOMPAT /PDB:".\bin\Test\NNExtended.pdb" /DYNAMICBASE "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG:FULL /MACHINE:X64 /INCREMENTAL /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:".\bin\Test\NNExtended.exe.intermediate.manifest" /ILK:".\bin\Test\NNExtended.ilk" /NOLOGO /VERBOSE /TLBID:1
When I remove libucrtd.lib from the defaultlibs, I get a ton of linker errors for unresolved externals which is understandable! How do I solve this problem? I'd appreciate any help regarding this! Thank you!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In order to understand the problem, we need a small reproducer and exact reproducing steps that demonstrate your issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Anoban
The latest validated Visual Studio versions are--
V2022: 17.9.2
VS2019: 16.11.34
Can you please check if you problem still happens on these?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Anoban
Please try to set these:
set CMAKE_SHARED_LINKER_FLAGS=/FORCE:MULTIPLE
set CMAKE_MODULE_LINKER_FLAGS=/FORCE:MULTIPLE
set CMAKE_EXE_LINKER_FLAGS=/FORCE:MULTIPLE
or you can try this https://www.intel.com/content/www/us/en/docs/dpcpp-cpp-compiler/developer-guide-reference/2025-0/no-intel-lib-qno-intel-lib.html to specify which Intel library not to link, in this case is libm in order to avoid the duplication symbol definitions.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page