Failure when trying to compile pascal programs via Notepad++?

时光总嘲笑我的痴心妄想 提交于 2019-12-23 16:34:40

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!