diff --git a/releasenotes.md b/releasenotes.md index fe38e4aa4..4612abc0f 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -36,6 +36,7 @@ - Introduce `$vaarg[...]` syntax and deprecate the old `$vaarg(...)`. - Similar change to `$vasplat`: `$vasplat` and `$vasplat[1..]`. - Add `$member.get(value)` to replace `value.$eval($member.nameof)` +- Improve the error message when the compilation does not produce any files #1390. ### Fixes diff --git a/src/compiler/compiler.c b/src/compiler/compiler.c index b1a6615d5..fd4d02ed7 100644 --- a/src/compiler/compiler.c +++ b/src/compiler/compiler.c @@ -510,7 +510,16 @@ void compiler_compile(void) } if (!output_file_count) { - error_exit("No output files found."); + if (output_exe) + { + error_exit("No output files were generated. This may happen if the program is not " + "linked with anything and all the code is optimized away."); + } + else + { + error_exit("No output files were generated. This may happen if there were no exported functions " + "and all the other code was optimized away."); + } } CompileData *compile_data = ccalloc(sizeof(CompileData), output_file_count);