These are chat archives for fmtlib/fmt

24th
Feb 2018
Victor Zverovich
@vitaut
Feb 24 2018 07:46
Perhaps c++17 (for std::string_view) is not detected correctly. Could you post the full output of cmake?
Normally you need to compile fmt with same (or compatible) options as your project.
Victor Zverovich
@vitaut
Feb 24 2018 07:52
The function in question is defined here: https://github.com/fmtlib/fmt/blob/e92ba1071db7a1fcaee1274bef914bf639dae718/include/fmt/format.cc#L413 and the problem is likely due to mismatch in compiler options causing different string_view types to be used in mysource.cc and fmt (C++17 std::string_view vs fallback fmt::string_view).
Amos Bird
@amosbird
Feb 24 2018 07:58
hmm
@vitaut where is the cmake's output?
it seems it's using c++14
Victor Zverovich
@vitaut
Feb 24 2018 07:59
Are you building fmt from sources?
Amos Bird
@amosbird
Feb 24 2018 07:59
 ❯ cmake ..
-- CMake version: 3.10.2
-- Version: 5.0.0
-- Build type: Release
-- CPP14_FLAG: -std=c++14
-- Target 'doc' disabled (requires doxygen)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/amos/git/fmt/build
yup
Victor Zverovich
@vitaut
Feb 24 2018 07:59
c++14 explains it
Amos Bird
@amosbird
Feb 24 2018 07:59
so how can I fix it?
Victor Zverovich
@vitaut
Feb 24 2018 07:59
std::string_view was introduced in c++17
Amos Bird
@amosbird
Feb 24 2018 07:59
oh
Victor Zverovich
@vitaut
Feb 24 2018 07:59
Try building mysource with -std=c++14
Amos Bird
@amosbird
Feb 24 2018 08:00
yup, it works
Victor Zverovich
@vitaut
Feb 24 2018 08:01
Cool
Amos Bird
@amosbird
Feb 24 2018 08:01
hmm
but I need 17 for other purposes
Victor Zverovich
@vitaut
Feb 24 2018 08:02
support/cmake/cxx14.cmake can be extended to detect -std=c++17
or you can just add include/fmt/format.cc in your project
and it will get the same compiler options
Amos Bird
@amosbird
Feb 24 2018 08:03
support/cmake/cxx14.cmake can be extended to detect -std=c++17
is it trivial?
Victor Zverovich
@vitaut
Feb 24 2018 08:05
Yeah, let me try.
Amos Bird
@amosbird
Feb 24 2018 08:06
Thanks!
Victor Zverovich
@vitaut
Feb 24 2018 08:16
Thinking more of it, this may cause similar problem for people using c++14. I think a better option is to pass -std=c++17 (or 1z) to cmake: cmake -DCMAKE_CXX_FLAGS=-std=c++1z -DFMT_USE_CPP14=0 .
Amos Bird
@amosbird
Feb 24 2018 08:25
oh, ok, lemme try it
\o/ it works
Victor Zverovich
@vitaut
Feb 24 2018 08:27
Cool
I've opened an issue too: fmtlib/fmt#664