How To Compile Pascal Code Using Console (Windows 7)
When I was at school we have been learning Pascal programming language and I faced one problem. Since it was school they didn't introduce us to compiling and other stuff "behind the scenes". We used poorly supported 4-6 years old IDE which was also used in national exams. So my problem was that as technology progressed, 64-bit Windows 7 came to action and our beloved IDE now didn't compile a code on this new Operating System.
So what to do?
So if you have faced the similar problem or you just want to learn how to compile without IDE here is what you should do. Go to freepascal.org download and install version of free pascal compiler you need. In my case I need to select Windows 64-bit (in AMD64/x86_64 category).
But sadly that is not all you need to do before compiling. Now we must set PATH so that your Windows knows where your compiler is. To do that Right Click on My Computer and select Properties -> Advanced System Settings (in left panel) -> Advanced Tab -> Environment Variables. Now if you don't see PATH variable like in this picture - you should add one by pressing new. And in variable value put something like this:
It depends on where you have installed your FPC and what version it is.This path should lead to the folder containing "fpc.exe" application. This thing is your compiler. If there was already something in the path variable you should separate them with semicolons.
Get this party started!
So now you can start compiling your .pas files. All you need to do is place them somewhere like "C:/pascal" so that the destination to them is short. Open your command line (console) by writing "cmd" in Start menu search (yeah, that Start in your bottom-left corner). To open your pascal files folder now write "cd C:/pascal". To compile something write "fpc yourProgram.pas". And to open your written program just write "yourProgram.exe".
For editing my programs I prefer notepad++, but you can use any simple text editor. So now you have learned basics of compiling your code, using console and setting the paths. Feel free to ask any questions in comments below.
How To Compile Java
- How To Compile With Notepad++
Notepad++ is just a text editor that has syntax highlighting. I personally love using it, but the drawback is that I sometimes want compile and write code with the same tool. As you know Notepad++ has no...
- How To Compile Java Using Console in Windows
To compile .java programs first you need to get compiler. Get to download page here and select Download JDK. Then you'll have to select your Operating System. After downloading file you will have to install it...