Nguyễn Nam Khánh Nguyễn Nam Khánh - 11 months ago 133
Pascal Question

The command to move file * .pas to file * .exe in fpc.exe

I have a fpc.exe executable file that is supposed to transfer the * .pas file to * .exe file but when i click on it to write command it shows help, i write command but it does not work. The command is as follows (I learned from this link :https://www.freepascal.org/docs-html/user/userse10.html)
  fpc [options] prog.pp

I wrote on the command box
fpc C: \ Hello.pas prog.pp
I put the Hello.pas file in drive C
What should I do in this case

Thank you so much I tried it another way, is to cmd and then type the command
fpc D: \ Hello
And this is my video
https://youtu.be/MsOfohAZjqg
I finally did it. Thank you.

Answer Source

I wrote on the command box fpc C: \ Hello.pas prog.pp

There are several things wrong with this:

  1. You should leave out the "prog.pp". The example in the link is using that as an example of the name of the source file to compile. Yours is Hello.Pas.

  2. There should be no spaces in the file name of the source file.

  3. Do you have write permission to the root directory of your C: drive? If not, you should move your source file(s) to a directory where you do.

So, you need something like this

fpc C:\mypascal\Hello.Pas

This will only work, btw, if fpc is on your OS Path. If it isn't, then either add add it to the Path, or include the full path to fpc.exe in your compile command.

Btw, when you said

I have a fpc.exe executable file that is supposed to transfer the * .pas file to * .exe file

actually that is not quite right. You don't have the executable file, the executable file is what you are trying to create from the Hello.Pas file by compiling it using fpc.

when I click on the fpc file, it immediately prompts me to use and tells me to hit enter

I assume you mean that this happens when you click fpc.exe in an Explorer window. I'm afraid there is no easy way to avoid this - the same thing happens if you just type

C:>fpc

in a command window. It is just listing the various compiler options, etc, that you could specify. The way you avoid that in a command window is to specify the name of the source file you want to compile. Unfortunately, there isn't a simple way of specifying the source file when you click fpc. For Explorer, it is easiest to write a batch file which prompts you for the source file name and then invokes fpc to compile it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download