How to Compile When You Use Putty
PuTTY is a utility for the Windows operating system that allows the user to remotely log into another machine using the Secure Shell (SSH) protocol. When logged into another machine, the user can make full use of the machine as long as he knows how to use the command line, as PuTTY has no graphical interface. For programmers who are used to working with graphical integrated development environments with a "compile" button, this can be initially offsetting. However, these programmers just need to use the compiler's terminal commands with which their 20th-century predecessors were so familiar.
Instructions
-
GCC C/C++ Compiler
-
1
Type "cd" into the PuTTY terminal, followed by the directory address that holds the C or C++ source code you wish to compile.
-
2
Type "ls" if you are using PuTTY to log into a Unix-based machine, or "dir" if you are using PuTTY to log into a Windows machine, into the PuTTY terminal. This will cause the PuTTY terminal to list the files in your current directory. Ensure the source code file you wish to compile is present.
-
-
3
Type "gcc -o MyExecutable MySourceCode" where "MyExecutable" is the name you want your compiled executable to bear and "MySourceCode" is the name of the source code you want to compile. It will bear the ".c" or ".cpp" extension, depending on if it is a C language source file or a C++ language source file.
Javac
-
4
Type "cd" into the PuTTY terminal, followed by the directory address that holds the Java source code you wish to compile.
-
5
Type "ls" if you are using PuTTY to log into a Unix-based machine, or "dir" if you are using PuTTY to log into a Windows machine, into the PuTTY terminal. This will cause the PuTTY terminal to list the files in your current directory. Ensure the source code file you wish to compile is present.
-
6
Type "javac MySourceCodeFile.java" where "MySourceCodeFile" is the name of the java source code file you wish to compile. The javac compiler will automatically pull in any necessary dependencies your file might have.
MingGW
-
7
Type "cd" into the PuTTY terminal, followed by the directory address that holds the C++ source code you wish to compile.
-
8
Type "dir" into your PuTTY terminal, as MingGW is a Windows compiler, and the terminal will list the files in your current directory. Ensure the source code file you wish to compile is present.
-
9
Type "gcc -o MyExecutable MySourceCode.cpp" where "MyExecutable" is the name you want your compiled executable to bear and "MySourceCode" is the name of the source code you want to compile.
-
1
References
- Photo Credit Comstock/Comstock/Getty Images