From owner-freebsd-questions Mon Apr 12 15:53: 9 1999 Delivered-To: freebsd-questions@freebsd.org Received: from online.dct.com (online.dct.com [204.29.185.1]) by hub.freebsd.org (Postfix) with ESMTP id 61D47154F4 for ; Mon, 12 Apr 1999 15:53:07 -0700 (PDT) (envelope-from markm@online.dct.com) Received: (from markm@localhost) by online.dct.com (8.9.0.Beta5/8.8.8) id RAA00389; Mon, 12 Apr 1999 17:49:59 -0500 (CDT) Date: Mon, 12 Apr 1999 17:49:58 -0500 From: Mark To: knichel Cc: freebsd-questions@FreeBSD.ORG Subject: Re: g++ Message-ID: <19990412174958.A29741@online.dct.com> References: <19990412221912.C6D7F155E5@hub.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.1i In-Reply-To: <19990412221912.C6D7F155E5@hub.freebsd.org>; from knichel on Mon, Apr 12, 1999 at 06:17:40PM -0400 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Thus spake knichel (knichel@cdcsd.k12.ny.us): > I am new to FreeBSD and have a question. I teach a C++ class in High School > and want to teach programming in a terminal, so I set up a BSD box. I use > PICO as my editor and I can compile my program using "g++ -c new.cc", but > when I try to link my program using "g++ -o new.o" I get the following > error... > > /usr/lib/crt1.o: In function `_start': > /usr/lib/crt1.o(.text+0x69): undefined reference to `main' > > What does this mean (pardon my ignorance)? It means that you aren't linking right. "g++ -o new.o " won't do anything. If you want to compile to a .o, and then compile fully, try this: "g++ -c new.cc -o new.o" -- The -o is not needed, new.o will be made by default "g++ new.o -o new" -- Creates an executable called "new" remember, the -o switch just tells the compiler what to name the resulting file. above, "g++ -o new.o" didn't work because you were telling the compiler to name the resulting file "new.o" without actually giving it a file to copmile. hope that helps, -- Mark Maurer markm@dct.com Programmer, DCT Technologies mwmaurer@mtu.edu Senior, Michigan Technological University "During my service in the United States Congress, I took the initiative in creating the Internet." -- Al Gore To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message