Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
X-Originating-IP: [12.254.208.112]
X-Originating-Email: [mgainty@hotmail.com]
From: "Martin Gainty" <mgainty@hotmail.com>
To: <cygwin@cygwin.com>, "Parker, Ron" <rdparker@butlermfg.com>
Cc: <cygwin@cygwin.com>
References: <Pine.GSO.4.44.0304141600210.26381-100000@slinky.cs.nyu.edu>
Subject: Re: C++ Link Error
Date: Mon, 14 Apr 2003 15:12:25 -0700
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <Law10-OE32r9FFf70DQ00001a5c@hotmail.com>
X-OriginalArrivalTime: 14 Apr 2003 21:13:00.0601 (UTC) FILETIME=[A11A4A90:01C302CA]

which namespace are you using???
are you not supposed to have a namespace declaration such as
using std
-Martin

----- Original Message -----
From: "Igor Pechtchanski" <pechtcha@cs.nyu.edu>
To: "Parker, Ron" <rdparker@butlermfg.com>
Cc: <cygwin@cygwin.com>
Sent: Monday, April 14, 2003 1:08 PM
Subject: Re: C++ Link Error


> On Mon, 14 Apr 2003, Parker, Ron wrote:
>
> > I am experiencing a link error with C++ on Cygwin.  I have boiled it
> > down to a simple test case.  As far as I know I have every Cygwin
> > package installed. But I have been upgrading this installation for quite
> > some time.
> >
> > If I take a simple test.cpp file:
> >
> > =================================
> > #include <iostream>
> >
> > using std::cout;
> >
> > main()
> > {
> >         cout << "Test\n";
> >         return 0;
> > }
> > =================================
> >
> > And run g++, g++ (GCC) 3.2 20020927 (prerelease), against it.  I get the
> > following:
> >
> > $ g++ -o test test.cpp -lstdc++
> > /e/DOCUME~1/rdparker/LOCALS~1/Temp/ccWlq6qX.o(.text+0x27):test.cpp:
> > undefined reference to `_STL::cout'
> > /e/DOCUME~1/rdparker/LOCALS~1/Temp/ccWlq6qX.o(.text+0x5d):test.cpp:
> > undefined reference to
`_STL::ios_base::_Loc_init::_Loc_init[in-charge]()'
> > /e/DOCUME~1/rdparker/LOCALS~1/Temp/ccWlq6qX.o(.text+0x78):test.cpp:
> > undefined reference to `_STL::ios_base::Init::Init[in-charge]()'
> > /e/DOCUME~1/rdparker/LOCALS~1/Temp/ccWlq6qX.o(.text+0x93):test.cpp:
> > undefined reference to `_STL::ios_base::Init::~Init [in-charge]()'
> > /e/DOCUME~1/rdparker/LOCALS~1/Temp/ccWlq6qX.o(.text+0xae):test.cpp:
> > undefined reference to `_STL::ios_base::_Loc_init::~_Loc_init
[in-charge]()'
> >
/e/DOCUME~1/rdparker/LOCALS~1/Temp/ccWlq6qX.o(.text$_ZN4_STL8ios_base23_M_ch
> > eck_exception_maskEv+0x1d):test.cpp: undefined reference to
> > `_STL::ios_base::_M_throw_failure()'
> > collect2: ld returned 1 exit status
> >
> > Having '-lstdc++' on the end or not doesn't seem to matter.
>
> Ron,
>
> I can't reproduce it here (Win2k, g++ 3.2 20020927 prerelease).
> What does adding a "-v" flag to your link line show?
> What about "g++ -print-search-dirs" and
"g++ -print-file-name=libstdc++.a"?
> "g++ -print-libgcc-file-name"?
>
> Minor points:
> - -lstdc++ is implied and thus redundant
> - don't name your program "test", as it conflicts with /bin/test
> Igor
> --
> http://cs.nyu.edu/~pechtcha/
>       |\      _,,,---,,_ pechtcha@cs.nyu.edu
> ZZZzz /,`.-'`'    -.  ;-;;,_ igor@watson.ibm.com
>      |,4-  ) )-,_. ,\ (  `'-' Igor Pechtchanski
>     '---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!
>
> Knowledge is an unending adventure at the edge of uncertainty.
>   -- Leto II
>
>
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
>
>

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

