Mail Archives: djgpp/1998/06/06/10:32:10

From: Kbwms AT aol DOT com
Message-ID: <>
Date: Sat, 6 Jun 1998 10:31:47 EDT
To: nate AT cartsys DOT com
Cc: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Re: Need Help Compiling Code with Templates

Dear Nate Eldredge,

Thanks for your response.

On 06-05-98 at 19:31:23 EST you wrote:
> CC:	djgpp AT delorie DOT com
> At 08:42  6/3/1998 EDT, Kbwms AT aol DOT com wrote:
> >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.
> Oh! Yes, on closer inspection it looks like `crt0.o' is somehow trying to
> reference `main' instead of `_main', which is wrong. Are you using the stock
> crt0.o, or have you rebuilt it or something?
> Post the output of `nm lib/crt0.o', and perhaps its size and date stamp as
> well.

To repeat the error report from gcc:

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

Herewith are three pieces of data - date/size stamp for crt0.o and two
name searches, the first for crt0.o, and the second for crt1.o from libc.a. 
I don't see a reference to 'main' anywhere - just '_main' and '___main'.

Date Stamp:

-rw----   3916  10-06-96   4:02a   crt0.o

nm lib/crt0.o:

00000540 b .bss
000004a8 d .data
00000000 t .text
000002d8 T ___brk
         U ___crt1_startup
00000004 C ___djgpp_base_address
         U ___djgpp_ds_alias
00000800 C ___djgpp_memory_handle_list
000004a8 d ___djgpp_memory_handle_pointer
00000004 C ___djgpp_selector_limit
00000004 C ___djgpp_stack_limit
         U ___emu387_load_hook
000001d8 T ___exit
         U ___libc_ident_string
000002c0 T ___sbrk
000004a4 T __crt0_init_mcount
         U __crt0_startup_flags
         U __go32_info_block
00000004 C __stklen
00000004 C __stubinfo
00000299 t __what_size_app_thinks_it_is
0000054c b __what_size_dpmi_thinks_we_are
00000548 b __what_we_return_to_app_as_old_size
         U _main
000002dd t brk_common
00000491 t brk_error
0000048a t brk_nochange
000004a0 t brk_return
000000b0 t dos_alloc_ok
0000003f t ds_alias_ok
         U end
000001dc t exit
00000522 d exit16_first_byte
00000532 d exit16_last_byte
00000532 d hook_387_emulator
0000029d t lock_memory
0000047e t no_deadbeef
00000484 t no_fill_sbrk_memory
000001d3 t no_memory
00000518 d sbrk16_api_ofs
0000051c d sbrk16_api_seg
000004ac d sbrk16_first_byte
00000518 d sbrk16_last_byte
00000540 b sel_buf
00000000 T start
000001ac t use_stubinfo_stack_size
0000051e d zero


The excerpt for crt1.o from libc.a:

00000360 b .bss
00000350 d .data
00000000 t .text
00000354 D ___PROXY
0000035c D ___PROXY_LEN
00000350 D ___bss_count
00000004 C ___crt0_argc
00000004 C ___crt0_argv
         U ___crt0_load_environment_file
         U ___crt0_setup_arguments
000002bc T ___crt1_startup
         U ___djgpp_exception_setup
00000004 C ___dos_argv0
         U ___dpmi_allocate_ldt_descriptors
         U ___dpmi_get_segment_base_address
         U ___dpmi_get_version
         U ___dpmi_set_segment_limit
         U ___environ_changed
00000000 t ___gnu_compiled_c
         U ___main
         U ___movedata
         U __crt0_init_mcount
00000004 C __crt0_startup_flags
         U __get_dos_version
         U __go32_info_block
         U __npxsetup
         U __osmajor
         U __osminor
         U __stubinfo
         U __use_lfn
         U _abort
00000004 C _environ
         U _exit
         U _main
         U _malloc
00000000 t _setup_core_selector
00000140 t _setup_environment
000000b0 t _setup_go32_info_block
00000294 t _setup_os_version
0000003c t _setup_screens
         U _strcpy
00000000 t gcc2_compiled.

- Raw text -

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