| |
| Posted by Laurentiu Pancescu in reply to R B | PermalinkReply |
|
Laurentiu Pancescu
| Okay, RB, here's a tutorial for you.
First, open a console window, and type the following:
#include <stdio.h>
int main(void)
{
printf("Hello, world!\n");
}
Then, save it as "hello.c". In Notepad, you must include the double quotes, otherwise it will save it as hello.c.txt, which is kind of bad...
Then, open a command prompt (ask the XP guys here how to do this ;), and, assuming you set the PATH of your system to include the BIN directory of DigitalMars C++ (typically C:\DM\BIN), change the directory to where you saved the hello.c, and type the command:
sc hello.c
After a few seconds, you'll get a hello.exe (and other intermediate files
generated by the compiler) in the same directory. Type now "hello" to run
your EXE (without double quotes). Voila!
I assume that you're just starting with C, and perhaps later C++. You should get a good C (or C++) book for beginners, and a more friendly environment than this. For getting a friendlier environment, you could buy the CD: it has a lot of stuff on it, including a very powerfull IDE. (Hey, Walter, I'm doing free advertisement here... <g>).
Other options would be to get an older version of Borland C, or Borland C++ (see in the Community Museum): they have very easy to use IDEs, very suitable for beginners. For other alternatives, take a look at the free C/C++ compilers page, at Chris Heng's site (www.thefreecountry.com).
If you plan to learn C++, not C, I suggest you get a more (ISO-C++) compliant compiler. You can use VIDE (www.vgui.org) and either gcc or Borland C++ Builder free command line tools for this. And you could even learn to write your own makefiles! Or you could wait until DigitalMars C++ becomes fully compliant... <g>
I wish you good luck!
Laurentiu
"R B" <vikingsubway@yahoo.com> wrote in message news:actcng$69$1@digitaldaemon.com...
>
> when i write a C program, any actually, the compiler just flashes in a
black
> rectangle on the screen, my programs are writtren in notepad for XP saved
as
> .txt , is this OK? What am I doing wrong?
>
> Robert
>
>
|