www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - running compiler just flash on screen

↑ ↓ ← "R B" <vikingsubway yahoo.com> writes:
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
May 27 2002
→ Jan Knepper <jan smartsoft.cc> writes:
Begin naming your files .c or .cpp
Jan



R B wrote:

 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

May 27 2002
→ "Laurentiu Pancescu" <user domain.invalid> writes:
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

 rectangle on the screen, my programs are writtren in notepad for XP saved

 .txt , is this OK? What am I doing wrong?

 Robert

May 27 2002