delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/03/23:58:07

From: Kbwms AT aol DOT com
Message-ID: <9fbbd380.3575ed77@aol.com>
Date: Wed, 3 Jun 1998 20:42:30 EDT
To: nate AT cartsys DOT com (Nate Eldredge)
Cc: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Re: Need Help Compiling Code with Templates

Subj:	 Re: Need Help Compiling Code with Templates
To:	nate AT cartsys DOT com (Nate Eldredge)

Dear Nate Eldredge,

On 06-03-98 at 20:02:48 EST you wrote:
>
> At 05:20  6/3/1998 EDT, Kbwms AT aol DOT com wrote:
> >I am trying to compile and link some C++ code that uses templates.
> >At link time I get the following diagnostics:
> >
> >c:/djgpp.v2/lib/crt0.o(.data+0x92):crt0.s: undefined reference to `main'
> >c:/djgpp.v2/lib/libc.a(crt1.o)(.text+0x346):crt1.c: undefined reference to
> >`main'
> >
> >To get this far I used the following command line:
> >
> >gcc -o chk.exe -Wall -fguiding-decls -fname-mangling-version-1 *.cpp
>                                       ^^^^^^^^^^^^^^^^^^^^^^^^^
> >
> >I know that main is being compiled because I see some warning diagnostics
> >regarding comparison between signed and unsigned.
> >
> >Please tell me what I am doing wrong and how to fix it.
>

A possible explanation is that the external generated by the compiler is
"_main" whereas the undefined reference is to "main."  I see that this is
true for other programs that I have compiled but they don't use templates.


K.B. Williams

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019