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: gcc and iostream

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

On Thu, 30 Oct 2003 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++
>    -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:
Problem reports:

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