Path: utzoo!news-server.csri.toronto.edu!rutgers!dimacs.rutgers.edu!seismo!uunet!mcsun!ukc!stl!crc From: crc@stl.stc.co.uk (Clive Carter) Newsgroups: comp.binaries.ibm.pc.d Subject: Re: Problems using gcc ( dj1bin ) to compile c++ Summary: Can't compile simple c++ program Keywords: gcc g++ C c++ dj1bin Message-ID: <4143@stl.stc.co.uk> Date: 13 Mar 91 09:25:45 GMT References: <1991Feb27.145341.18701@newcastle.ac.uk> Sender: news@stl.stc.co.uk Reply-To: "Clive Carter" Followup-To: comp.binaries.ibm.pc.d Organization: STC Technology Limited, London Road, Harlow, Essex, UK Lines: 46 Julian Coleman writes: We are having problems getting gcc to compile a simple c++ program. This is the program : ----------------------------------------------------------------------- // File hello.c #include main () { cout << "hello world"; } ----------------------------------------------------------------------- This is the compile sequence for this program : ----------------------------------------------------------------------- C:\C\SOURCE\GCC\TEST>gcc -v -o hello hello.c gcc version 1.37.1 cpp -v -undef -D__GNUC__ -Dunix -Di386 -D__unix__ -D__i386__ hello.c c:/pdsoft/ gcpp/tmp/ccAA_AAA.cpp GNU CPP version 1.37.1 etc........... -------------------oOo------------------- Julian, I compiled and executed this program with no trouble. The problem is caused by telling gcc to compile a C program rather than a C++ one. What you should use is: // File hello.cc and C:\C\SOURCE\GCC\TEST>gcc -v -o hello hello.cc ----- Regards, Clive Carter (crc@stl.stc.co.uk (+44) 279 429531 ext3646)