This is the mail archive of the
mailing list for the Cygwin project.
Re: gcc and iostream
I don't know if any of these will address your problem, but...
On Thu, 30 Oct 2003 email@example.com 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&)'
> My compile line is:
> -mno-cygwin -g -o$(_Target)
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.
Again, using g++, omit this.
> <files needed to be linked>
Let us know if you try all that and still have problems.
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html