'Fatal: Cannot open file. Error: ppcx64.exe returned an error code

My code and Visual Studio Code's error message:

1

Why in Visual Studio Code I can't compile Pascal file but it working properly on FPC IDE or Sublime Text 4 with ObjectPascal package?

My file dir:

d:\Programming\Pascal\Learning\Boi_Duong\#9_Buoi9.pas

Error message:

Free Pascal Compiler version 3.2.2 [2021/05/15] for i386
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling #9_Buoi9.pas
Fatal: Cannot open file "#9_Buoi9.pas"
Fatal: Compilation aborted
Error: C:\FPC\3.2.2\bin\i386-Win32\ppc386.exe returned an error exitcode


Solution 1:[1]

First, set you default terminal to Command Prompt: Press Ctrl+Shift+P to open Command Palette, find Terminal: Select your default profile. Then choose Command Prompt.

Then, you need to configure your compiling command in settings.json for Code Runner extension. Open settings.json by press Ctrl+ Shift+P and add this setting:

"code-runner.executorMap": {
    "pascal": "fpc $fullFileName && $dir$fileNameWithoutExt"
},

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nimantha