jamboree / bustache

C++20 implementation of {{ mustache }}
82 stars 10 forks source link

Compiling Error #34

Closed AstroAir closed 1 year ago

AstroAir commented 1 year ago

Sorry to bother you ,I tried to compile on Msys2(Mingw64) , but failed. Cmake:

-- Building for: Ninja
-- The CXX compiler identification is GNU 13.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: E:/msys64/mingw64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Started CMake for bustache v0.1.0...

-- Configuring done (2.9s)
-- Build files have been written to: E:/msys64/home/test/bustache-master/build

Error:

FAILED: CMakeFiles/bustache.dir/src/render.cpp.obj
E:\msys64\mingw64\bin\c++.exe  -IE:/msys64/home/Qrm/test/bustache-master/include -IE:/msys64/home/Qrm/test/bustache-master/src -std=gnu++20 -MD -MT CMakeFiles/bustache.dir/src/render.cpp.obj -MF CMakeFiles\bustache.dir\src\render.cpp.obj.d -o CMakeFiles/bustache.dir/src/render.cpp.obj -c E:/msys64/home/Qrm/test/bustache-master/src/render.cpp
In file included from E:/msys64/home/Qrm/test/bustache-master/include/bustache/render.hpp:10,
                 from E:/msys64/home/Qrm/test/bustache-master/src/render.cpp:8:
E:/msys64/home/Qrm/test/bustache-master/include/bustache/model.hpp: In instantiation of 'void bustache::detail::print_fmt(const T&, bustache::output_handler, const char*) [with T = std::basic_string_view<char>; bustache::output_handler = bustache::fn_ref<void(const char*, long long unsigned int)>]':
E:/msys64/home/Qrm/test/bustache-master/src/render.cpp:503:30:   required from here
E:/msys64/home/Qrm/test/bustache-master/include/bustache/model.hpp:355:16: error: no matching function for call to 'std::basic_format_context<std::back_insert_iterator<bustache::detail::output_buffer>, char>::basic_format_context(<brace-enclosed initializer list>)'
  355 |         FmtCtx ctx{OutIter(buf), fmt::make_format_args<FmtCtx>()};
      |                ^~~
In file included from E:/msys64/home/Qrm/test/bustache-master/include/bustache/model.hpp:20:
E:/msys64/mingw64/include/c++/13.2.0/format:3373:7: note: candidate: 'std::basic_format_context<_Out, _CharT>::basic_format_context(std::basic_format_args<std::basic_format_context<_Out, _CharT> >, _Out, const std::locale&) [with _Out = std::back_insert_iterator<bustache::detail::output_buffer>; _CharT = char]'
 3373 |       basic_format_context(basic_format_args<basic_format_context> __args,
      |       ^~~~~~~~~~~~~~~~~~~~
E:/msys64/mingw64/include/c++/13.2.0/format:3373:7: note:   candidate expects 3 arguments, 2 provided
E:/msys64/mingw64/include/c++/13.2.0/format:3368:7: note: candidate: 'std::basic_format_context<_Out, _CharT>::basic_format_context(std::basic_format_args<std::basic_format_context<_Out, _CharT> >, _Out) [with _Out = std::back_insert_iterator<bustache::detail::output_buffer>; _CharT = char]'
 3368 |       basic_format_context(basic_format_args<basic_format_context> __args,
      |       ^~~~~~~~~~~~~~~~~~~~
E:/msys64/mingw64/include/c++/13.2.0/format:3368:68: note:   no known conversion for argument 1 from 'OutIter' {aka 'std::back_insert_iterator<bustache::detail::output_buffer>'} to 'std::basic_format_args<std::basic_format_context<std::back_insert_iterator<bustache::detail::output_buffer>, char> >'
 3368 |       basic_format_context(basic_format_args<basic_format_context> __args,
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
E:/msys64/mingw64/include/c++/13.2.0/format:3360:11: note: candidate: 'std::basic_format_context<std::back_insert_iterator<bustache::detail::output_buffer>, char>::basic_format_context(const std::basic_format_context<std::back_insert_iterator<bustache::detail::output_buffer>, char>&)'
 3360 |     class basic_format_context
      |           ^~~~~~~~~~~~~~~~~~~~
E:/msys64/mingw64/include/c++/13.2.0/format:3360:11: note:   candidate expects 1 argument, 2 provided
E:/msys64/home/Qrm/test/bustache-master/include/bustache/model.hpp: In instantiation of 'void bustache::detail::print_fmt(const T&, bustache::output_handler, const char*) [with T = bool; bustache::output_handler = bustache::fn_ref<void(const char*, long long unsigned int)>]':
E:/msys64/home/Qrm/test/bustache-master/src/render.cpp:511:30:   required from here
E:/msys64/home/Qrm/test/bustache-master/include/bustache/model.hpp:355:16: error: no matching function for call to 'std::basic_format_context<std::back_insert_iterator<bustache::detail::output_buffer>, char>::basic_format_context(<brace-enclosed initializer list>)'
  355 |         FmtCtx ctx{OutIter(buf), fmt::make_format_args<FmtCtx>()};
      |                ^~~
E:/msys64/mingw64/include/c++/13.2.0/format:3373:7: note: candidate: 'std::basic_format_context<_Out, _CharT>::basic_format_context(std::basic_format_args<std::basic_format_context<_Out, _CharT> >, _Out, const std::locale&) [with _Out = std::back_insert_iterator<bustache::detail::output_buffer>; _CharT = char]'
 3373 |       basic_format_context(basic_format_args<basic_format_context> __args,
      |       ^~~~~~~~~~~~~~~~~~~~
E:/msys64/mingw64/include/c++/13.2.0/format:3373:7: note:   candidate expects 3 arguments, 2 provided
E:/msys64/mingw64/include/c++/13.2.0/format:3368:7: note: candidate: 'std::basic_format_context<_Out, _CharT>::basic_format_context(std::basic_format_args<std::basic_format_context<_Out, _CharT> >, _Out) [with _Out = std::back_insert_iterator<bustache::detail::output_buffer>; _CharT = char]'
 3368 |       basic_format_context(basic_format_args<basic_format_context> __args,
      |       ^~~~~~~~~~~~~~~~~~~~
E:/msys64/mingw64/include/c++/13.2.0/format:3368:68: note:   no known conversion for argument 1 from 'OutIter' {aka 'std::back_insert_iterator<bustache::detail::output_buffer>'} to 'std::basic_format_args<std::basic_format_context<std::back_insert_iterator<bustache::detail::output_buffer>, char> >'
 3368 |       basic_format_context(basic_format_args<basic_format_context> __args,
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
E:/msys64/mingw64/include/c++/13.2.0/format:3360:11: note: candidate: 'std::basic_format_context<std::back_insert_iterator<bustache::detail::output_buffer>, char>::basic_format_context(const std::basic_format_context<std::back_insert_iterator<bustache::detail::output_buffer>, char>&)'
 3360 |     class basic_format_context
      |           ^~~~~~~~~~~~~~~~~~~~
E:/msys64/mingw64/include/c++/13.2.0/format:3360:11: note:   candidate expects 1 argument, 2 provided
ninja: build stopped: subcommand failed.
jamboree commented 1 year ago

Unfortunately, the standard doesn't provide a way to construct the std::basic_format_context, the only way seems to be std::vformat_to. Will fix later.