delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/10/30/17:58:54

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: eos.vss.fsi.com: ford owned process doing -bs
Date: Thu, 30 Oct 2003 16:58:40 -0600 (CST)
From: Brian Ford <ford AT vss DOT fsi DOT com>
X-X-Sender: ford AT eos
To: cygwin AT cygwin DOT com
Subject: Re: gcc and iostream
In-Reply-To: <1067549281.3fa18261b9137@www.nexusmail.uwaterloo.ca>
Message-ID: <Pine.GSO.4.56.0310301651310.9896@eos>
References: <1067549281 DOT 3fa18261b9137 AT www DOT nexusmail DOT uwaterloo DOT ca>
MIME-Version: 1.0

I don't know if any of these will address your problem, but...

On Thu, 30 Oct 2003 y2bismil AT engmail DOT uwaterloo DOT ca wrote:

> I am using
> #include <iostream>
> using namespace std;
>
I might reverse the order of those two, but I don't know if it matters.
I'm not a c++ person.

> Its a pretty large project.  First, all the sources and compiled into object
> files using gcc.  Then to link, I've tried both gcc and g++.
>
You should never compile or link c++ source files with gcc.  Use g++.

> Both times using -lstdc++ as a paramter.
>
If you use g++, as you should, this is not necessary.

> Yet, I always seem to get iostream errors like:
>
> : undefined reference to `ostream::operator<<(char const*)
> : undefined reference to `_cin'
> : undefined reference to `_cout'
> :undefined reference to `istream& operator>><int>(istream&, smanip<int> const&)'
>
Don't know.

> My compile line is:
> gcc/g++
>
g++
>    -mno-cygwin  -g -o$(_Target)
>    -LC:\cygwin\lib\mingw
>
Don't hand DOS paths to Cygwin utilities (ie. leave off the C:\).  And the
-mno-cygwin flag makes this redundant, so don't use it.

>    -Wl,--start-group
>    -lwsock32
>    -lstdc++
>
Again, using g++, omit this.

>    <files needed to be linked>
>    -Wl,--end-group
>
Let us know if you try all that and still have problems.

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax:   314-551-8444

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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