objeck / objeck-lang

Objeck is a modern object-oriented programming language with functional features tailored for machine learning. It emphasizes expression, simplicity, portability, and scalability. The programming environment consists of a compiler, virtual machine, REPL shell, and command line debugger with IDE plugins.
https://objeck.org
Other
157 stars 11 forks source link

Unable to compile `module/example` on MSYS2 (UCRT) #309

Closed ghost closed 1 year ago

ghost commented 1 year ago

It seems module/example is not built during the deploy process so I tried to build it manually. This is what I see:

Administrator@Admin UCRT64 ~/objeck-lang/core/module/example
$ make -f make/Makefile.msys2-ucrt.amd64
g++ -m64 -O3 -Wall -std=c++17 -D_X64 -D_OBJECK_NATIVE_LIB_PATH -Wno-unused-function -c example.cpp
example.cpp: In function 'std::wstring ReadFile(std::wstring)':
example.cpp:43:31: error: no matching function for call to 'std::basic_ifstream<wchar_t>::basic_ifstream(const std::wstring&)'
   43 |   std::wifstream file(filename);
      |                               ^
In file included from ../../compiler/tree.h:35,
                 from ../../compiler/compiler.h:37,
                 from ../lang.h:35,
                 from example.cpp:1:
C:/msys64/ucrt64/include/c++/13.2.0/fstream:586:9: note: candidate: 'template<class _Path, class _Require> std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const _Path&, std::ios_base::openmode) [with _Require = _Path; _CharT = wchar_t; _Traits = std::char_traits<wchar_t>]'
  586 |         basic_ifstream(const _Path& __s,
      |         ^~~~~~~~~~~~~~
C:/msys64/ucrt64/include/c++/13.2.0/fstream:586:9: note:   template argument deduction/substitution failed:
C:/msys64/ucrt64/include/c++/13.2.0/fstream:585:32: error: 'class std::__cxx11::basic_string<wchar_t>' has no member named 'make_preferred'
  585 |       template<typename _Path, typename _Require = _If_fs_path<_Path>>
      |                                ^~~~~~~~
C:/msys64/ucrt64/include/c++/13.2.0/fstream:594:7: note: candidate: 'std::basic_ifstream<_CharT, _Traits>::basic_ifstream(std::basic_ifstream<_CharT, _Traits>&&) [with _CharT = wchar_t; _Traits = std::char_traits<wchar_t>]'
  594 |       basic_ifstream(basic_ifstream&& __rhs)
      |       ^~~~~~~~~~~~~~
C:/msys64/ucrt64/include/c++/13.2.0/fstream:594:39: note:   no known conversion for argument 1 from 'const std::wstring' {aka 'const std::__cxx11::basic_string<wchar_t>'} to 'std::basic_ifstream<wchar_t>&&'
  594 |       basic_ifstream(basic_ifstream&& __rhs)
      |                      ~~~~~~~~~~~~~~~~~^~~~~
C:/msys64/ucrt64/include/c++/13.2.0/fstream:569:7: note: candidate: 'std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const std::string&, std::ios_base::openmode) [with _CharT = wchar_t; _Traits = std::char_traits<wchar_t>; std::string = std::__cxx11::basic_string<char>; std::ios_base::openmode = std::ios_base::openmode]'
  569 |       basic_ifstream(const std::string& __s,
      |       ^~~~~~~~~~~~~~
C:/msys64/ucrt64/include/c++/13.2.0/fstream:569:41: note:   no known conversion for argument 1 from 'const std::wstring' {aka 'const std::__cxx11::basic_string<wchar_t>'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
  569 |       basic_ifstream(const std::string& __s,
      |                      ~~~~~~~~~~~~~~~~~~~^~~
C:/msys64/ucrt64/include/c++/13.2.0/fstream:551:7: note: candidate: 'std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const wchar_t*, std::ios_base::openmode) [with _CharT = wchar_t; _Traits = std::char_traits<wchar_t>; std::ios_base::openmode = std::ios_base::openmode]'
  551 |       basic_ifstream(const wchar_t* __s,
      |       ^~~~~~~~~~~~~~
C:/msys64/ucrt64/include/c++/13.2.0/fstream:551:37: note:   no known conversion for argument 1 from 'const std::wstring' {aka 'const std::__cxx11::basic_string<wchar_t>'} to 'const wchar_t*'
  551 |       basic_ifstream(const wchar_t* __s,
      |                      ~~~~~~~~~~~~~~~^~~
C:/msys64/ucrt64/include/c++/13.2.0/fstream:536:7: note: candidate: 'std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const char*, std::ios_base::openmode) [with _CharT = wchar_t; _Traits = std::char_traits<wchar_t>; std::ios_base::openmode = std::ios_base::openmode]'
  536 |       basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in)
      |       ^~~~~~~~~~~~~~
C:/msys64/ucrt64/include/c++/13.2.0/fstream:536:34: note:   no known conversion for argument 1 from 'const std::wstring' {aka 'const std::__cxx11::basic_string<wchar_t>'} to 'const char*'
  536 |       basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in)
      |                      ~~~~~~~~~~~~^~~
C:/msys64/ucrt64/include/c++/13.2.0/fstream:525:7: note: candidate: 'std::basic_ifstream<_CharT, _Traits>::basic_ifstream() [with _CharT = wchar_t; _Traits = std::char_traits<wchar_t>]'
  525 |       basic_ifstream() : __istream_type(), _M_filebuf()
      |       ^~~~~~~~~~~~~~
C:/msys64/ucrt64/include/c++/13.2.0/fstream:525:7: note:   candidate expects 0 arguments, 1 provided
make: *** [make/Makefile.msys2-ucrt.amd64:12: example.o] Error 1
objeck commented 1 year ago

It should work now. The error was GCC-specific.