Mail Archives: djgpp/1999/11/01/20:12:32
From: | ryot AT bigfoot DOT com (George Ryot)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: Installing DJGPP
|
Message-ID: | <381e132b.246010@news.clara.net>
|
References: | <01bf247c$ff4638c0$1f8510d4 AT odete>
|
X-Newsreader: | Forte Agent 1.5/32.452
|
MIME-Version: | 1.0
|
Lines: | 126
|
Date: | Mon, 01 Nov 1999 23:49:09 GMT
|
NNTP-Posting-Host: | 195.8.92.57
|
X-Complaints-To: | abuse AT clara DOT net
|
X-Trace: | nnrp3.clara.net 941500149 195.8.92.57 (Mon, 01 Nov 1999 23:49:09 GMT)
|
NNTP-Posting-Date: | Mon, 01 Nov 1999 23:49:09 GMT
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
"Orlando" <ep1341 AT hotmail DOT com> wrote:
> I have windows 97. I've done all the installation procedures until
> rebooting my machine. Now I don't have a clue of how or where to write the
> gcc command:
>
> gcc myfile, etc...
>
> Where do I write this. Do I work with windows explorar and open in the BIN
> directory the GCC program?
>
> What do I do?
Hmm, a four word question that will need a long answer!
I am assuming that you haven't yet met the DOS prompt. You will need
to get to know this very well if you are to succeed with DJGPP! ;-)
I am also assuming that this is your first C program, sorry if some of
this seems too basic.
So you have unpacked all the neccessary ZIPs into a directory
C:\DJGPP, you have edited autoexec.bat and rebooted ...
gcc is run from the command line so you need to open a DOS prompt.
From the Start menu, under Programs, select MS-DOS Prompt. This
should bring up a DOS window showing:
C:\WINDOWS>
This is where you type commands. If you would prefer to work with a
full screen you can press Alt-Enter. The command prompt shows that
you are currently working in the Windows directory on the C: drive.
That is not a good place to write programs so first you should create
a new directory. Type the following commands as shown:
C:\WINDOWS>cd \
C:\>md code
C:\>cd code
C:\code>
Now you have a place to write programs. You can use the MS-DOS editor
to create your first C program, but as you learn more you will want to
change to a better editor. Run the editor with the following command
(note it is important to use lower case):
C:\code>edit hello.c
You are now using the editor, you can still use Alt-Enter to switch
between window and full screen modes. Also note the mouse can *not*
be used to select menu items, this is done with the Alt key.
Type the following short six line program in the editor:
#include <stdio.h>
int main(void)
{
printf("Hello World!\n");
return 0;
}
Save the file by typing Alt F S
Exit the editor by typing Alt F X
Do not fret, we are nearly there. ;-)
Now, back at the DOS prompt type dir to see the file you have created:
C:\code>dir
Volume in drive C is C
Volume Serial Number is 135D-210F
Directory of C:\code
. <DIR> 01/11/99 19:35 .
.. <DIR> 01/11/99 19:35 ..
HELLO C 92 01/11/99 19:59 hello.c
1 file(s) 92 bytes
2 dir(s) 1,894,055,936 bytes free
And finally, the moment you have been waiting for! :
C:\code>gcc -Wall hello.c -o hello
If you get the error 'Bad command or file name' it means you did not
install DJGPP properly. If you get other errors run the editor again
to fix them, or ask here again for more help. If gcc runs and exits
without saying anything then all is well. You can see that gcc did
actually compile by running dir again:
C:\code>dir
Volume in drive C is C
Volume Serial Number is 135D-210F
Directory of C:\code
. <DIR> 01/11/99 19:35 .
.. <DIR> 01/11/99 19:35 ..
HELLO C 92 01/11/99 19:59 hello.c
HELLO 99,482 01/11/99 20:03 hello
HELLO EXE 101,530 01/11/99 20:03 hello.exe
3 file(s) 201,104 bytes
2 dir(s) 1,894,842,368 bytes free
The file HELLO.EXE is your program, run it just by typing its name:
C:\code>hello
Hello World!
C:\code>
Now does that feel good?
Well I hope you managed to get this far! :-)
That is only enough to start with. All of the DOS commands will
provide brief help if you type the command followed by /?
C:\code>cd /?
will display help for the change directory command.
--
george
- Raw text -