esseks / monicelli

An esoteric programming language, come se fosse antani.
GNU General Public License v3.0
1.32k stars 52 forks source link

Compilation Fails on MinGW #28

Closed mrjackv closed 5 years ago

mrjackv commented 8 years ago

While I was trying to compile monicelli in MinGW I got the following errors:

1. Boost native() assumes std::string is made of wchar_t under windows

main.cpp:112:81: error: conversion from 'const string_type {aka const std::__cxx11::basic_string<wchar_t>}' to non-scalar type 'std::__cxx11::string {aka std::__cxx11::basic_string<char>}' requested

I think it's not a mistake on monicelli's part (I think boost assumes that all string are wchar in windows), however judging from the boost documentation string() would be a more fitting option, e.g.

std::string outputname = boost::filesystem::path(name).filename().string();

2. CppEmitter fuctions expect bool return and instead get ostream

CppEmitter.cpp: In member function 'virtual bool monicelli::CppEmitter::emit(const monicelli::Program&)':
CppEmitter.cpp:78:12: error: cannot convert 'std::ostream {aka std::basic_ostream<char>}' to 'bool' in return
return stream;
       ^

(a.k.a. #27) I'm unsure whether it's an unimplemented feature of the GCC I'm using or some linux-only autoconversion. According to this example the typecast should be explicit.

Build Details

The following packages were used to compile: Mingw x86/64 sjlj with pthreads msys2-provided flex msys2-provided bison As for the rest:

They've been compiled from source with the respective checkouts/tars The cmake (3.2.2) was run with the following command

cmake .. -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=/opt/monicelli -DCMAKE_BUILD_TYPE=RELEASE -DBOOST_INCLUDEDIR=/opt/boost/include/boost-1_59 -DBOOST_LIBRARYDIR=/opt/boost/lib -DLLVM_DIR=/opt/llvm/share/llvm/cmake -DYAML_INCLUDE_DIRS=/opt/yaml-cpp/include -DYAML_LIBRARIES=/opt/yaml-cpp/lib/libyaml-cpp.a -DCMAKE_CXX_FLAGS="-I/usr/include"

P.S. Kudos for the awesome language

esseks commented 8 years ago

Hi, thanks for the detailed report.

Regarding point 1, I will try to fix it asap. Expect a commit shortly. If you could confirm that things work as intended it would be great!

Regarding point 2, the explicit part in the explicit operator bool() const signature is meant to replace the safe-bool idiom we used to use before C++11. AFAIK it doesn't mean you have to write static_cast<bool>(stream), although I admit the name could be misleading. Could it be that the MinGW compiler hasn't catched up yet with this C++11 feature? I will investigate.

P.S. Kudos for the awesome language

Thanks :) I very much hope to succeed in pushing it as the next industrial standard.

esseks commented 8 years ago

Apologies for the very long time the bugfix is taking, unfortunately I am yet to find the time to setup a windows build environment with all the required components.

esseks commented 5 years ago

This issue should be solved in the latest release. I'm closing this issue as obsolete, but feel free to reopen it if it doesn't work for you.