Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FMT Visual Studio Linking error #2101

Closed
iharden opened this issue Jan 17, 2021 · 4 comments
Closed

FMT Visual Studio Linking error #2101

iharden opened this issue Jan 17, 2021 · 4 comments

Comments

@iharden
Copy link

iharden commented Jan 17, 2021

I am trying to use fmt as a statically linked library in my project on Windows. Here is how I tried to install it:

  1. Downloaded fmt-7.1.2 and go to fmt directory
    2. mkdir build
  2. cd build
  3. cmake -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE .. This produces a FMT.sln in /build.
  4. Open FMT.sln in VS and build ALL_BUILD (Release, x64). This works without errors.
  5. This produces Release/fmt.lib
  6. When I add fmt-7.1.2/build/Release to the VC++ library directories, I get the following Linking errors:
1>functions.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""void __cdecl fmt::v7::detail::assert_fail(char const *,int,char const *)" (?assert_fail@detail@v7@fmt@@YAXPEBDH0@Z)" in Funktion ""public: class fmt::v7::detail::buffer_appender<char> __cdecl fmt::v7::detail::arg_formatter_base<class fmt::v7::detail::buffer_appender<char>,char,struct fmt::v7::detail::error_handler>::operator()<float,0>(float)" (??$?RM$0A@@?$arg_formatter_base@V?$buffer_appender@D@detail@v7@fmt@@DUerror_handler@234@@detail@v7@fmt@@QEAA?AV?$buffer_appender@D@123@M@Z)".
1>functions.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: void __cdecl fmt::v7::detail::error_handler::on_error(char const *)" (?on_error@error_handler@detail@v7@fmt@@QEAAXPEBD@Z)" in Funktion ""void __cdecl fmt::v7::detail::check_pointer_type_spec<char,struct fmt::v7::detail::error_handler>(char,struct fmt::v7::detail::error_handler &&)" (??$check_pointer_type_spec@DUerror_handler@detail@v7@fmt@@@detail@v7@fmt@@YAXD$$QEAUerror_handler@012@@Z)".
1>functions.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl fmt::v7::detail::vformat(class fmt::v7::basic_string_view<char>,struct fmt::v7::format_args)" (?vformat@detail@v7@fmt@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$basic_string_view@D@23@Uformat_args@23@@Z)" in Funktion ""class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl fmt::v7::format<char [17],int &,int &,char>(char const (&)[17],int &,int &)" (??$format@$$BY0BB@DAEAHAEAHD@v7@fmt@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAY0BB@$$CBDAEAH1@Z)".
1>functions.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: virtual __cdecl fmt::v7::format_error::~format_error(void)" (??1format_error@v7@fmt@@UEAA@XZ)" in Funktion ""public: unsigned int __cdecl fmt::v7::detail::printf_width_handler<char>::operator()<char,0>(char)" (??$?RD$0A@@?$printf_width_handler@D@detail@v7@fmt@@QEAAID@Z)".
1>functions.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl fmt::v7::detail::grouping_impl<char>(class fmt::v7::detail::locale_ref)" (??$grouping_impl@D@detail@v7@fmt@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@Vlocale_ref@012@@Z)" in Funktion ""class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl fmt::v7::detail::grouping<char>(class fmt::v7::detail::locale_ref)" (??$grouping@D@detail@v7@fmt@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@Vlocale_ref@012@@Z)".
1>functions.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""char __cdecl fmt::v7::detail::thousands_sep_impl<char>(class fmt::v7::detail::locale_ref)" (??$thousands_sep_impl@D@detail@v7@fmt@@YADVlocale_ref@012@@Z)" in Funktion ""char __cdecl fmt::v7::detail::thousands_sep<char>(class fmt::v7::detail::locale_ref)" (??$thousands_sep@D@detail@v7@fmt@@YADVlocale_ref@012@@Z)".
1>functions.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""char __cdecl fmt::v7::detail::decimal_point_impl<char>(class fmt::v7::detail::locale_ref)" (??$decimal_point_impl@D@detail@v7@fmt@@YADVlocale_ref@012@@Z)" in Funktion ""char __cdecl fmt::v7::detail::decimal_point<char>(class fmt::v7::detail::locale_ref)" (??$decimal_point@D@detail@v7@fmt@@YADVlocale_ref@012@@Z)".
1>functions.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""int __cdecl fmt::v7::detail::format_float<double>(double,int,struct fmt::v7::detail::float_specs,class fmt::v7::detail::buffer<char> &)" (??$format_float@N@detail@v7@fmt@@YAHNHUfloat_specs@012@AEAV?$buffer@D@012@@Z)" in Funktion ""class fmt::v7::detail::buffer_appender<char> __cdecl fmt::v7::detail::write<char,class fmt::v7::detail::buffer_appender<char>,float,0>(class fmt::v7::detail::buffer_appender<char>,float,struct fmt::v7::basic_format_specs<char>,class fmt::v7::detail::locale_ref)" (??$write@DV?$buffer_appender@D@detail@v7@fmt@@M$0A@@detail@v7@fmt@@YA?AV?$buffer_appender@D@012@V3012@MU?$basic_format_specs@D@12@Vlocale_ref@012@@Z)".
1>functions.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""int __cdecl fmt::v7::detail::format_float<long double>(long double,int,struct fmt::v7::detail::float_specs,class fmt::v7::detail::buffer<char> &)" (??$format_float@O@detail@v7@fmt@@YAHOHUfloat_specs@012@AEAV?$buffer@D@012@@Z)" in Funktion ""class fmt::v7::detail::buffer_appender<char> __cdecl fmt::v7::detail::write<char,class fmt::v7::detail::buffer_appender<char>,long double,0>(class fmt::v7::detail::buffer_appender<char>,long double,struct fmt::v7::basic_format_specs<char>,class fmt::v7::detail::locale_ref)" (??$write@DV?$buffer_appender@D@detail@v7@fmt@@O$0A@@detail@v7@fmt@@YA?AV?$buffer_appender@D@012@V3012@OU?$basic_format_specs@D@12@Vlocale_ref@012@@Z)".
1>functions.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""int __cdecl fmt::v7::detail::snprintf_float<double>(double,int,struct fmt::v7::detail::float_specs,class fmt::v7::detail::buffer<char> &)" (??$snprintf_float@N@detail@v7@fmt@@YAHNHUfloat_specs@012@AEAV?$buffer@D@012@@Z)" in Funktion ""class fmt::v7::detail::buffer_appender<char> __cdecl fmt::v7::detail::write<char,class fmt::v7::detail::buffer_appender<char>,float,0>(class fmt::v7::detail::buffer_appender<char>,float,struct fmt::v7::basic_format_specs<char>,class fmt::v7::detail::locale_ref)" (??$write@DV?$buffer_appender@D@detail@v7@fmt@@M$0A@@detail@v7@fmt@@YA?AV?$buffer_appender@D@012@V3012@MU?$basic_format_specs@D@12@Vlocale_ref@012@@Z)".
1>functions.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""int __cdecl fmt::v7::detail::snprintf_float<long double>(long double,int,struct fmt::v7::detail::float_specs,class fmt::v7::detail::buffer<char> &)" (??$snprintf_float@O@detail@v7@fmt@@YAHOHUfloat_specs@012@AEAV?$buffer@D@012@@Z)" in Funktion ""class fmt::v7::detail::buffer_appender<char> __cdecl fmt::v7::detail::write<char,class fmt::v7::detail::buffer_appender<char>,long double,0>(class fmt::v7::detail::buffer_appender<char>,long double,struct fmt::v7::basic_format_specs<char>,class fmt::v7::detail::locale_ref)" (??$write@DV?$buffer_appender@D@detail@v7@fmt@@O$0A@@detail@v7@fmt@@YA?AV?$buffer_appender@D@012@V3012@OU?$basic_format_specs@D@12@Vlocale_ref@012@@Z)".
1>functions.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""public: static unsigned int const * const fmt::v7::detail::basic_data<void>::zero_or_powers_of_10_32_new" (?zero_or_powers_of_10_32_new@?$basic_data@X@detail@v7@fmt@@2QBIB)".
1>functions.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""public: static unsigned __int64 const * const fmt::v7::detail::basic_data<void>::zero_or_powers_of_10_64_new" (?zero_or_powers_of_10_64_new@?$basic_data@X@detail@v7@fmt@@2QB_KB)".
1>functions.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""public: static char const (* fmt::v7::detail::basic_data<void>::digits)[2]" (?digits@?$basic_data@X@detail@v7@fmt@@2QAY01$$CBDA)".
1>functions.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""public: static char const * const fmt::v7::detail::basic_data<void>::hex_digits" (?hex_digits@?$basic_data@X@detail@v7@fmt@@2QBDB)".
1>functions.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""public: static char const * const fmt::v7::detail::basic_data<void>::signs" (?signs@?$basic_data@X@detail@v7@fmt@@2QBDB)".
1>functions.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""public: static char const * const fmt::v7::detail::basic_data<void>::left_padding_shifts" (?left_padding_shifts@?$basic_data@X@detail@v7@fmt@@2QBDB)".
1>functions.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""public: static char const * const fmt::v7::detail::basic_data<void>::right_padding_shifts" (?right_padding_shifts@?$basic_data@X@detail@v7@fmt@@2QBDB)".

Does anyone know how to solve this?

@vitaut
Copy link
Contributor

vitaut commented Jan 17, 2021

Looks like the same as #2011.

@iharden
Copy link
Author

iharden commented Jan 17, 2021

Thanks a lot but this was not the issue, tested with fmt-7.1.3

@vitaut vitaut removed the duplicate label Jan 17, 2021
@vitaut
Copy link
Contributor

vitaut commented Jan 17, 2021

Then please post a complete example that reproduces the error.

@vitaut vitaut reopened this Jan 17, 2021
@iharden
Copy link
Author

iharden commented Jan 17, 2021

I actually fixed this issue. The problem was that VS used x64. Switching to x86 solved the Linker errors.

@iharden iharden closed this as completed Jan 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants