fmtlib / fmt

A modern formatting library
https://fmt.dev
Other
19.83k stars 2.42k forks source link

Linker Error with fmt Library in Visual Studio 2019 Project #4003

Closed dd123-a closed 3 weeks ago

dd123-a commented 3 weeks ago

Description: When utilizing the fmt library within a project compiled using Visual Studio 2019, an unresolved external symbol error is encountered during the build process. Specifically, the compiler reports that it cannot find the symbol related to fmt::v10::detail::value constructor for fmt::v10::basic_format_context with fmt::v10::appender. This symbol is referenced in the function responsible for printing formatted text.

Details:

Error Message: Error LNK2019: unresolved external symbol "public: cdecl fmt::v10::detail::value<class fmt::v10::basic_format_context<class fmt::v10::appender,char> >::value<class fmt::v10::basic_format_context<class fmt::v10::appender,char> >(struct fmt::v10::detail::unformattable_pointer)" (??0?$value@V?$basic_format_context@appender@v10@fmt@@D@v10@fmt@@@detail@v10@fmt@@QEAA@Uunformattable_pointer@123@@Z) referenced in function "void cdecl fmt::v10::print<char [24],unsigned char const ,unsigned char const ,0>(class fmt::v10::text_style const &,char const (&)[24],unsigned char const const &,unsigned char const const &)" (?print@$$BY0BI@DPEBEPEBE0A@@v10@fmt@@YAXAEBVtext_style@01@AEAY0BI@$$CBDAEBQEBE2@Z) Project: synthlike

File: C:\Users\DrTang\Desktop\ecs-sandbox\Window.obj

Line: 1

Environment:

Compiler: Microsoft Visual Studio 2019 Configuration: Specify the exact configuration used (e.g., Release|x64) Steps to Reproduce:

Incorporate fmt library into a Visual Studio 2019 C++ project. Implement code that utilizes fmt for formatting output, similar to the context described in the error message. Attempt to build the solution. Expected Outcome: A successful build without linker errors.

Actual Outcome: The linker fails due to the inability to resolve the specified fmt library symbol.

Troubleshooting Efforts:

Confirmed the fmt library version compatibility with the project. Ensured the library is correctly installed and included in the project's include path. Performed a clean rebuild of the project. Requested Assistance: Seeking guidance to identify the cause of this linker error and potential solutions to rectify it. This may involve correcting library linking procedures, ensuring proper fmt usage, or addressing other configuration discrepancies.

dd123-a commented 3 weeks ago

Could this issue possibly stem from using incompatible or differing versions of the fmt library with Visual Studio 2019?

vitaut commented 3 weeks ago

Same as #3828. The error indicates that you are trying to format a non-void pointer which is not supported (although normally you should get a compilation, not linker error).