ACM Balloon Logo
 
ACM 2002 Collegiate Programming Contest

South Central USA Regional Programming Contest

How to Compile
 
LSU Clocktower Logo

This page will list a number of useful processes that may be helpful to contest competitors.


How to run an executable in the current directory

For security reasons, the current directory is NOT in your path. This means that if you wish to run the executable hello that is in the same directory that you are in, you must type: ./hello. This says to explicitly run the hello executable that is in the current directory.

Return to Top of Page


Compile a C program with gcc

The gcc command is used to invoke the GNU C compiler. Both input source file and executable file name must be specified. This is the command to use if you have a C source file called hello.c and wish to create the executable file hello.

gcc hello.c -o hello
To utilize gcc version 3, you would type the following:
gcc3 hello.c -o hello
If you are including <math.h> do not forget to put the -lm at the end of the compile line.
gcc3 hello.c -o hello -lm

Return to Top of Page


Compile a C++ program with g++

The g++ command is used to invoke the GNU C++ compiler. Both input source file and executable file name must be specified. This is the command to use if you have a C++ source file called hello.cpp and wish to create the executable file hello.

g++ hello.cpp -o hello
To utilize gcc version 3, you would type the following:
g++3 hello.cpp -o hello

Return to Top of Page


Using Kylix C/C++ GUI

When you start the Kylix C/C++ GUI, it assumes you wish to make a GUI application. The following steps will get you to the point where you can write a console application.

The following line in your source causes a three line Kylix license message to be displayed each time you run your program. These are the lines that will be at the top: displayed. The line is:

This application must be distributed under the terms of the GNU General
Public License (GPL), version 2. A copy of this license can be found at:
http://www.borland.com/kylix/gpl.html.

Return to Top of Page


Command line compile of a C program with Kylix

Kylix uses the same command to invoke both the C and the C++ compilers: bc++. You need only specify the name of the source file. It automatically creates an executable (if compilation and linking are without error) that is the same name as the source file when you remove the extension.

bc++ hello.c
This command will produce the executable: hello.

Return to Top of Page


Command line compile of a C++ program with Kylix

Kylix uses the same command to invoke both the C and the C++ compilers: bc++. You need only specify the name of the source file. It automatically creates an executable (if compilation and linking are without error) that is the same name as the source file when you remove the extension.

bc++ hello.cpp
This command will produce the executable: hello.

Return to Top of Page


Using Kylix Delphi GUI

When you start the Kylix Delphi GUI, it assumes you wish to make a GUI application. The following steps will get you to the point where you can write a console application.

The following line in your source causes a three line Kylix license message to be displayed each time you run your program. You can remove this line and the message will not be displayed. The line is:

{$APPTYPE CONSOLE}

Return to Top of Page


Command line compile of a delphi program with Kylix

Kylix uses the dcc command to invoke the Delphi (Pascal) compiler. You need only specify the name of the source file. It automatically creates an executable (if compilation and linking are without error) that is the same name as the source file when you remove the extension.

dcc hello.pas
This command will produce the executable: hello.

Return to Top of Page


Kylix output quirk

When you run an executable created with Kylix (c, c++, or Pascal), you will always see the following lines at the top of your printout:

This application must be distributed under the terms of the GNU General
Public License (GPL), version 2. A copy of this license can be found at:
http://www.borland.com/kylix/gpl.html.

Return to Top of Page


Compile a Java program with Sun JDK

The javac command is used to compile java source files.

javac hello.java
This will produce java.class.

Return to Top of Page


Execute a compiled Java program

The java command is used to execute java class file.

java hello

Return to Top of Page


The statements and opinions included in these pages are those of Hosts of the South Central USA Regional Programming Contest only. Any statements and opinions included in these pages are not those of Louisiana State University or the LSU Board of Supervisors.
© 1999, 2000, 2001, 2002 Isaac Traxler