Date: Mon, 12 Apr 1999 17:49:58 -0500 From: Mark <markm@online.dct.com> To: knichel <knichel@cdcsd.k12.ny.us> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: g++ Message-ID: <19990412174958.A29741@online.dct.com> In-Reply-To: <19990412221912.C6D7F155E5@hub.freebsd.org>; from knichel on Mon, Apr 12, 1999 at 06:17:40PM -0400 References: <19990412221912.C6D7F155E5@hub.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990412174958.A29741>