Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Dec 1996 12:45:33 +1030 (CST)
From:      Michael Smith <msmith@atrad.adelaide.edu.au>
To:        francisco@natserv.com
Cc:        chat@freebsd.org
Subject:   Re: Comments on using C++ instead of C
Message-ID:  <199612290215.MAA02284@genesis.atrad.adelaide.edu.au>
In-Reply-To: <199612290152.UAA28924@revelstone.jvm.com> from Francisco Reyes at "Dec 28, 96 07:04:38 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Francisco Reyes stands accused of saying:
> I have never programmed for Unix before and am about to start a small
> project. I was wondering if there are any advantages of using C over
> C++.

Erk.  Don't start another language war.  Use whichever language you are
most comfortable with.

> Does the compiler that comes with FreeBSD do C++? I tried compiling a
> trivial C++ program using gcc and it failed. Must one send a parameter
> to gcc to tell it the code is C++?

You can either :

 - Name your files correctly (.c for C, .cc or .C for C++)
 - Call the compiler as 'g++'

Personally, I recommend using a Makefile like :

PROG=	foo
SRCS=	foo.cc
NOMAN=	yes
LDADD=	-lg++
COPTS=	-g

.include <bsd.prog.mk>

... which knows everything required to build your C++ program.

-- 
]] Mike Smith, Software Engineer        msmith@gsoft.com.au             [[
]] Genesis Software                     genesis@gsoft.com.au            [[
]] High-speed data acquisition and      (GSM mobile)     0411-222-496   [[
]] realtime instrument control.         (ph)          +61-8-8267-3493   [[
]] Unix hardware collector.             "Where are your PEZ?" The Tick  [[



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612290215.MAA02284>