diff --git a/vlib/v/builder/c.v b/vlib/v/builder/c.v index e80ab4070a..3368ad6949 100644 --- a/vlib/v/builder/c.v +++ b/vlib/v/builder/c.v @@ -46,7 +46,7 @@ pub fn (mut b Builder) build_c(v_files []string, out_file string) { } pub fn (mut b Builder) compile_c() { - if os.user_os() != 'windows' && b.pref.ccompiler == 'msvc' { + if os.user_os() != 'windows' && b.pref.ccompiler == 'msvc' && !b.pref.out_name.ends_with('.c') { verror('Cannot build with msvc on $os.user_os()') } // cgen.genln('// Generated by V') diff --git a/vlib/v/builder/msvc.v b/vlib/v/builder/msvc.v index 3c00a11bd2..e41ad03519 100644 --- a/vlib/v/builder/msvc.v +++ b/vlib/v/builder/msvc.v @@ -181,7 +181,12 @@ fn find_msvc() ?MsvcResult { valid: true } } $else { - return error('msvc not found') + // This hack allows to at least see the generated .c file with `-os windows -cc msvc -o x.c` + // Please do not remove it, unless you also check that the above continues to work. + return MsvcResult{ + full_cl_exe_path: '/usr/bin/true' + valid: true + } } }