You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If using MSVC 2017 + Intel Compiler v19.0, the linker error below can be eliminated by switching on: Interprocedural Optimization: Multi-File (/Qipo).
This is nothing to do with the {fmt} library, it appears to be a bug in the Intel Compiler.
Details
When compiling {fmt} with MSVC 2017 + Intel Compiler v19.0, the following compile error may occur if the {fmt} libraries are included in the file pch.h (i.e. the pre-compiled header file):
This error will never occur if switching to the MSVC compiler.
This error will not occur if the {fmt} header files are not included in pch.h (i.e. they are included in main.cpp).
This error typically occurs in Debug mode, but not in Release mode as this mode has a default of Interprocedural Optimization: Multi-File (/Qipo).
Linker error:
2>pch.obj : : error LNK2005: "union std::_Align_type<double,16> `class std::_Generic_error_category & __cdecl std::_Immortalize<class std::_Generic_error_category>(void)'::`2'::_Storage" (?_Storage@?1???$_Immortalize@V_Generic_error_category@std@@@std@@YAAEAV_Generic_error_category@1@XZ@4T?$_Align_type@N$0BA@@1@A) already defined in Main.obj
2>pch.obj : : error LNK2005: __cp_array_end_?_Storage@?1???$_Immortalize@V_Generic_error_category@std@@@std@@YAAEAV_Generic_error_category@1@XZ@4T?$_Align_type@N$0BA@@1@A already defined in Main.obj
2>pch.obj : : error LNK2005: "union std::_Align_type<double,16> `class std::_Iostream_error_category & __cdecl std::_Immortalize<class std::_Iostream_error_category>(void)'::`2'::_Storage" (?_Storage@?1???$_Immortalize@V_Iostream_error_category@std@@@std@@YAAEAV_Iostream_error_category@1@XZ@4T?$_Align_type@N$0BA@@1@A) already defined in Main.obj
2>pch.obj : : error LNK2005: __cp_array_end_?_Storage@?1???$_Immortalize@V_Iostream_error_category@std@@@std@@YAAEAV_Iostream_error_category@1@XZ@4T?$_Align_type@N$0BA@@1@A already defined in Main.obj
2>pch.obj : : error LNK2005: "union std::_Align_type<double,16> `class std::_System_error_category & __cdecl std::_Immortalize<class std::_System_error_category>(void)'::`2'::_Storage" (?_Storage@?1???$_Immortalize@V_System_error_category@std@@@std@@YAAEAV_System_error_category@1@XZ@4T?$_Align_type@N$0BA@@1@A) already defined in Main.obj
2>pch.obj : : error LNK2005: __cp_array_end_?_Storage@?1???$_Immortalize@V_System_error_category@std@@@std@@YAAEAV_System_error_category@1@XZ@4T?$_Align_type@N$0BA@@1@A already defined in Main.obj
2>Test.obj : : error LNK2005: "union std::_Align_type<double,16> `class std::_Generic_error_category & __cdecl std::_Immortalize<class std::_Generic_error_category>(void)'::`2'::_Storage" (?_Storage@?1???$_Immortalize@V_Generic_error_category@std@@@std@@YAAEAV_Generic_error_category@1@XZ@4T?$_Align_type@N$0BA@@1@A) already defined in Main.obj
2>Test.obj : : error LNK2005: __cp_array_end_?_Storage@?1???$_Immortalize@V_Generic_error_category@std@@@std@@YAAEAV_Generic_error_category@1@XZ@4T?$_Align_type@N$0BA@@1@A already defined in Main.obj
2>Test.obj : : error LNK2005: "union std::_Align_type<double,16> `class std::_Iostream_error_category & __cdecl std::_Immortalize<class std::_Iostream_error_category>(void)'::`2'::_Storage" (?_Storage@?1???$_Immortalize@V_Iostream_error_category@std@@@std@@YAAEAV_Iostream_error_category@1@XZ@4T?$_Align_type@N$0BA@@1@A) already defined in Main.obj
2>Test.obj : : error LNK2005: __cp_array_end_?_Storage@?1???$_Immortalize@V_Iostream_error_category@std@@@std@@YAAEAV_Iostream_error_category@1@XZ@4T?$_Align_type@N$0BA@@1@A already defined in Main.obj
2>Test.obj : : error LNK2005: "union std::_Align_type<double,16> `class std::_System_error_category & __cdecl std::_Immortalize<class std::_System_error_category>(void)'::`2'::_Storage" (?_Storage@?1???$_Immortalize@V_System_error_category@std@@@std@@YAAEAV_System_error_category@1@XZ@4T?$_Align_type@N$0BA@@1@A) already defined in Main.obj
2>Test.obj : : error LNK2005: __cp_array_end_?_Storage@?1???$_Immortalize@V_System_error_category@std@@@std@@YAAEAV_System_error_category@1@XZ@4T?$_Align_type@N$0BA@@1@A already defined in Main.obj
2>File.exe : : error LNK1169: one or more multiply defined symbols found
Cause of Issue
The line that triggers the linker error is this:
#include <iterator> // Included in `format.h`.
For the record, the project was rebuilt from scratch between switching compilers, so this is not an issue where old incompatible header files were left over from a previous build under a different compiler.
The text was updated successfully, but these errors were encountered:
sharpe5
changed the title
MSVC + Intel Compiler v19.0: Fails to compile in pre-compiled header mode unless "Enable Interprocedural Optimisation" is switched on
MSVC 2017 + Intel Compiler v19.0: Fails to compile in pre-compiled header mode unless "Enable Interprocedural Optimisation" is switched on
Aug 31, 2019
If there are persistent Intel compiler errors that mention a lack of symbol "wmemcmp" during the linking phase, there is another, really heavy-handed solution: create a separate project, place the {fmt} library inside it, and compile it with MSVC. Then add this library to the main project which is compiled with Intel Compiler v19.0. The linkers for MSVC and Intel are 100% compatible, so everything should work well.
IOW
If using MSVC 2017 + Intel Compiler v19.0, the linker error below can be eliminated by switching on:
Interprocedural Optimization: Multi-File (/Qipo)
.This is nothing to do with the
{fmt}
library, it appears to be a bug in the Intel Compiler.Details
When compiling
{fmt}
with MSVC 2017 + Intel Compiler v19.0, the following compile error may occur if the{fmt}
libraries are included in the filepch.h
(i.e. the pre-compiled header file):{fmt}
header files are not included inpch.h
(i.e. they are included inmain.cpp
).Debug
mode, but not inRelease
mode as this mode has a default ofInterprocedural Optimization: Multi-File (/Qipo)
.Linker error:
Cause of Issue
The line that triggers the linker error is this:
For the record, the project was rebuilt from scratch between switching compilers, so this is not an issue where old incompatible header files were left over from a previous build under a different compiler.
The text was updated successfully, but these errors were encountered: