This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: linking problem, please help


The cygwin mailing list is the proper place for such inquiries.  It is
strongly discouraged to send personal mail with such requests, and they
will, in general, be ignored.  I've forwarded this request to the proper
mailing list, and reset the Reply-to: field accordingly for your

On Mon, 23 Dec 2002, Trimurthi, Swamy(IE10) wrote:

> Hi Pechta,
>      I found your mail id while searchig for some solution on the internet
> regarding a linking problem I am facing. It would be of great help to me if
> I can get some guidance from you.  I am using cygwin version [ GNU bash,
> version 2.05.0(8)-release (i686-pc-cygwin) ] on a WinNT machine, x86
> processor. I was trying to link the following sample code
> *************************************
> #include<iostream>
> int main()
> {
> 	cout<<"\n hello world";
> 	return 0;
> }
> **************************************
> I was able to compile the code using the following command
> g++ -c test.cpp
> and generated the object code test.o, but I was not able to link it using ld
> and hence unable to generate the exe
> I gave the ld command and following was the output
> *************************************************
> $ ld -o test C:/cygwin/lib/crt0.o test.o -lc
> test.o(.text+0x24):test.cpp: undefined reference to `cout'
> test.o(.text+0x29):test.cpp: undefined reference to
> `ostream::operator<<(char const *)'
> test.o(.text$__tf3ios+0x29):test.cpp: undefined reference to `__rtti_si'
> test.o(.text$__tf9streambuf+0x29):test.cpp: undefined reference to
> `__rtti_si'
> test.o(.text$__tf7filebuf+0x29):test.cpp: undefined reference to `__rtti_si'
> test.o(.text$__tf7ostream+0x28):test.cpp: undefined reference to
> `__rtti_class'
> test.o(.text$__tf7istream+0x28):test.cpp: undefined reference to
> `__rtti_class'
> test.o(.text$__tf8iostream+0x30):test.cpp: undefined reference to
> `__rtti_class'
> test.o(.text$__tf22_IO_istream_withassign+0x28):test.cpp: undefined
> reference to `__rtti_class'
> test.o(.text$__tf22_IO_ostream_withassign+0x28):test.cpp: undefined
> reference to `__rtti_class'
> test.o(.text$__tf11_ios_fields+0x1d):test.cpp: undefined reference to
> `__rtti_user'
> test.o(.text$__tf8_IO_FILE+0x1d):test.cpp: undefined reference to
> `__rtti_user'
> /usr/lib/libc.a(_cygwin_crt0_common.o): In function `cygwin_crt0_common':
> /cygnus/netrel/src/cygwin-1.3.3-2/winsup/cygwin/lib/
> 0: undefined reference t
> o `GetModuleHandleA@4'
> **************************************************
> Could you guide me like where the problem is and whether do I need to
> include crtbegin and crtend files. When these files are generally required.
> I am eager to hear from you
> thanks in advance,
> regards,
> Trimurthi

      |\      _,,,---,,_
ZZZzz /,`.-'`'    -.  ;-;;,_
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk!
  -- /usr/games/fortune

Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]