Subject: Re: Please help
From: "Larry Hall (RFK Partners, Inc)" <[email-masked]>
To: "J. E. Touma" <[email-masked]>
Cc: "[email-masked]" <[email-masked]>
Date: Thu, 12 Oct 2000 10:06:55 -0400

At 09:42 PM 10/11/2000, J. E. Touma wrote:
>"Larry Hall (RFK Partners, Inc)" wrote:
> > 
> > At 05:53 PM 10/11/2000, J. E. Touma wrote:
> > >Hi all,
> > >I'm having a problem compiling my C++ code under cygwin. It compiles
> > >fine under Linux and Solaris.
> > >Here is the error message I'm getting after I type make
> > >
> > >g++ -mno-cygwin -L/cygnus/mingw/lib -o afsri vecmatlib.o myutils.o Sri.o
> > >mymath.o srifuncs.o irmaimage.o -lm
> > >Sri.o(.text$__ls__H3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i0_R7ostreamRCt12basic_string3ZX01ZX11ZX21_R7ostream+0x18):Sri.cc:
> > >undefined reference to `ostream::write(char const *, int)'
> > >collect2: ld returned 1 exit status
> > >make: *** [afsri] Error 1
> > >
> > >
> > >Now if I compile without -mno-cygwin -L/cygnus/mingw/lib (so that I can
> > >run the code with the DLL) it works fine.
> > >I have all the appropriate header files. What is frustrating is that  I
> > >don't even use ostream::write(char const *, int)' in the Sri.cc
> > >mentioned above. Yes I open a file stream but I write asci text to it,
> > >not binary.
> > >
> > >Is there a problem with the fstream.h file? It is on my system.
> > >
> > >Any insight into this problem is appreciated.
> > >
> > >Regads,
> > >jim
> > 
> > Your problem is obviously at link time, not compile time, so there's no
> > issue with include files.  Your problem is the library you want isn't
> > getting linked in.  So, the question is, which library are you using?
> > Are you pulling in ostream from iostream.h or ostream?  This will tell
> > you whether you need the standard C++ library or the "old" stream stuff.
> > Once you know that, you'll be better able to find the library you're looking
> > for.  As I recall, MS sectioned out the stream stuff from their standard
> > runtime library back around VC++ 4 or 5.  This was done to accommodate the
> > use of either the "old" stream implementation or the new standard C++
> > template stuff.  I forget all the details but searching the MSDN site should
> > tell you which libraries you need depending on which version of the stream
> > stuff you're trying to use.  Once you determine the library you need and
> > link it in, you'll be done.
> > 
> > Strictly speaking, if this works fine with Cygwin and not with -mno-cygwin,
> > then this is a Mingw issue.  You might find some additional information and
> > help on this subject if you check out www.mingw.org.
> > 
> > Larry Hall                              [email-masked]
> > RFK Partners, Inc.                      http://www.rfk.com
> > 118 Washington Street                   (508) 893-9779 - RFK Office
> > Holliston, MA 01746                     (508) 893-9889 - FAX
>
>Larry,
>I am using the header files without the .h extension, like
>#include <iostream>
>using namespace std;
>
>I am also using the latest version of cygwin.

OK so you're using the standard C++ template library (i.e. the new stuff).
Again, I don't recall the details of the library name for this but you 
should be able to track it down in MSDN (that's where I found it originally
when I had a like problem in VC++ some time ago).  Also, I would recommend 
looking at Mingw if you really don't need cygwin1.dll.  There may be 
differences in the configuration of gcc between Cygwin and Mingw (like the 
specs file) that will point to the source of your problem when you use 
-mno-cygwin.  Alternatively, if you don't want to compare the environments to 
see if it helps you find the problem, you can download Mingw and see if you 
can just build what you have without any fuss.  Compiling with gcc and 
-mno-cygwin under Cygwin is a close second to compiling with Mingw but 
they are not the same thing.

Larry Hall                              [email-masked]
RFK Partners, Inc.                      http://www.rfk.com
118 Washington Street                   (508) 893-9779 - RFK Office
Holliston, MA 01746                     (508) 893-9889 - FAX

--
Want to unsubscribe from this list?
Send a message to [email-masked]