gcc - xemacs integration on MS-Windows

Installating gcc

In the following, we'l assume the your gcc executable file has been installed in the C:\gcc\bin directory. Please adapt pathnames to your custom installation if necessary.

We wll now edit the  AUTOEXEC.BAT located on your main hard drive. In this file, search for the line that begins with 
set PATH=
or
PATH=
This line contains several directory names spearated by semi-columns. At the end of this line, add the following text (do NOT put a space before this text and do NOT forget the final dot):
;c:\gcc\bin;.

For instance, if your AUTOEXEC.BAT file used to be:
set PATH=C:\;C:\Windows
it should n
set PATH=C:\;C:\Windows;c:\gcc\bin;.

If your AUTOEXEC.BAT file does not contain such a line, just create one:
set PATH=c:\gcc\bin;.

Then see wether your AUTOEXEC.BAT file contains a line beggining with
set HOME=
If it does not, just create one that indicates your personal directory. For instance, if you have created a  C:\Arthur directory for your personal use, write:
set HOME=C:\Arthur

Save the AUTOEXEC.BAT file and reboot.

XEmacs installation

Once XEmacs is installed, save the ".emacs" file by clicking on this link: .emacs. This file has to be in your personnal directory (the one associated with the HOME variable). It contains all necessary initialisations to have an environnement similar to the one provided on SUN stations at the EPFL (reasonably comfortable).

Beware: Windows95/98 tend to think themselves more intelligent than you and will likely try and prevent you from saving the file as .emacs , be it at loading time in your browser, or at saving time.
Tp overcome this problem, you can download the file with another name,  emacs.el for instance. Then open this file with XEmacs and use the  "Save As..." command, in the "File" menu,  choose .emacs as a name, and save it in your personal directory.  For instance, if you put
set HOME=C:\Arthur
in your  autoexec.bat file, then use the "Save As..." command in the "File" menu and choose the name:
C:\Arthur\.emacs
Then quit XEmacs and restart it.

One last word...

Open XEmacs. Edit the ~/hello.c file (the ~ sign stands for your personal directory, defined by the HOME variable) and try and compile using the "Compile" button in the tool bar. XEmacs should suggest a compilation line such as:
gcc -g -Wall -o hello.exe hello.c

Note: the ".exe" extension indicates an executable file in Windows.

If it does not (if t suggests make -k instead), it means the .emacs has not been found. The more likely is you didn't copy the file in the directory associated with the HOME variable in the AUTOEXEC.BAT file, ot that this variable has not been set correctly. Check your  AUTOEXEC.BAT file again, check that your .emacs is correctly copied, and reboot.

If XEmacs says that gcc could not be found, it is likely that the PATH variable of your AUTOEXEC.BAT file does not include the directory where gcc is installed. Check AUTOEXEC.BAT and reboot.

If the compilation works, a  hello.exe file should have been generated. Open a MS-DOS terminal, go to the directory where the hello.exe file  is located (using the "cd" command). Make sure your hello.exe executable is here (using the dir command). Then execute the program by typing
hello
or
hello.exe
or
.\hello.exe