问题
I'm trying to complile pascal files with Notepad++ on Free Pascal Compiler. I've been instructed to use the following script:
NPP_SAVE
cd $(CURRENT_DIRECTORY)
C:\FPC\2.6.4\bin\i386-win32\ppcrossx64.exe $(NAME_PART).pas
But when I try to run the program, Notepad++ console gives me the following message:
NPP_SAVE: C:\FPC\2.6.4\bin\i386-win32\new 1.pas
CD: C:\FPC\2.6.4\bin\i386-win32
Current directory: C:\FPC\2.6.4\bin\i386-win32
C:\FPC\2.6.4\bin\i386-win32\ppcrossx64.exe new 1.pas
Process started >>>
Fatal: Can't open file "1.pas"
Fatal: Compilation aborted
<<< Process finished. (Exit code 1)
================ READY ================
I've tried to use also:
C:\FPC\2.6.4\bin\i386-win32\ppcrossx64.exe "$(FULL_CURRENT_PATH)"
But it gives me:
C:\FPC\2.6.4\bin\i386-win32\ppcrossx64.exe "C:\FPC\2.6.4\bin\i386-win32\new 1.pas"
Process started >>>
<<< Process finished. (Exit code 0)
================ READY ================
Even if I have: readln();
in the program.
回答1:
Your second command (with the quotes) seems to compile successfully. It reports the exit code 0. You can try to deliberately include a syntax error and see if and how the compiler reports it.
I think what you are missing now is a way to run the program after the compile is successfull. You can create a second script with something like this:
cd "$(CURRENT_DIRECTORY)"
"$(NAME_PART).exe"
Bind the first compile script to a keyboard shortcut, bind the second run script to a different keyboard shortcut, only run when the compile is ok.
来源:https://stackoverflow.com/questions/32535675/failure-when-trying-to-compile-pascal-programs-via-notepad