public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Brian Ford <ford@vss.fsi.com>
To: cygwin@cygwin.com
Subject: Re: gcc and iostream
Date: Fri, 31 Oct 2003 02:26:00 -0000	[thread overview]
Message-ID: <Pine.GSO.4.56.0310301651310.9896@eos> (raw)
In-Reply-To: <1067549281.3fa18261b9137@www.nexusmail.uwaterloo.ca>

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

On Thu, 30 Oct 2003 y2bismil@engmail.uwaterloo.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/

  reply	other threads:[~2003-10-30 22:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-30 22:35 y2bismil
2003-10-31  2:26 ` Brian Ford [this message]
2003-10-31  7:20   ` Gary R. Van Sickle
2003-10-31 10:00 ` Gerrit P. Haase
2003-10-31 16:22   ` y2bismil
2003-10-31 17:00     ` y2bismil
2003-10-31 18:13       ` gcc and iostream - final issue y2bismil
2003-10-31 18:39         ` Christopher Faylor
2003-10-31 21:07         ` Brian Ford
2003-10-31 21:34           ` y2bismil
2003-10-31 22:05             ` gcc and iostream - resolved y2bismil
2003-10-31 22:48               ` Brian Ford
2003-10-31 22:24             ` gcc and iostream - final issue Brian Ford
2003-10-30 22:41 gcc and iostream Timothy C Prince

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.GSO.4.56.0310301651310.9896@eos \
    --to=ford@vss.fsi.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).