This is the mail archive of the cygwin@cygwin.com 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]

Re: Building Mingw console applications under Cygwin


The problem is that -mno-cygwin support in cygwin only works OUT-OF-THE-BOX
for _c_ applications, not _c++_ applications.

In the errors you see below like:
 /usr/lib/libstdc++.a(fileops.o)(.text+0x19d):fileops.c: undefined
reference to `__errno'
^^^^^^^^^^^^^^
Note that this is the cygwin libstdc++, not the mingw libstdc++.

The correct mingw lib path is specified: (due to -mno-cygwin options & gcc
specs file)
> -L/usr/lib/mingw -L/usr/lib/w32api
  ^^^^^^^^^^^^
However, there is no libstdc++.a in this location, so the linker picks up
the one from /user/lib instead. OOPS!

Solution:
(1) search the mailing list for detailed instructions. This seems to come up
about once a week.
(2) download mingw headers & libraries from the mingw website
(3) install these (manully) in the appropriate locations under
/usr/include/mingw & /usr/lib/mingw

HTH.

---
David Carter
david@carter.net

----- Original Message -----
From: <ajr@lme-da.com>
To: <cygwin@cygwin.com>
Sent: Wednesday, October 10, 2001 10:36 AM
Subject: Building Mingw console applications under Cygwin


> Hi,
>
> I seem to be missing a point somewhere I think. I'm trying to build a
> native Windoze console application using gcc under the Cygwin
> environment. I am using the following make options:
>
> CXXFLAGS += -mno-cygwin
> CPPFLAGS += -I/usr/include/g++-3
> LDFLAGS += -v -mno-cygwin
> LOADLIBES += -lstdc++ -lwsock32
>
> This gives me the following command lines and error messages when I
> compile:
>
> Building MINGWdebug version of
> /cygdrive/d/software/stlplus/test/TCP/client
> make -C ../../../../stlplus/source
> Building MINGWdebug version of /cygdrive/d/software/stlplus/source
> make[1]: Entering directory `/cygdrive/d/software/stlplus/source'
> make[1]: Nothing to be done for `all'.
> make[1]: Leaving directory `/cygdrive/d/software/stlplus/source'
> gcc  -v -mno-cygwin MINGWdebug/libTCP.a
> ../../../../stlplus/source/MINGWdebug/libstlplus.a  -lstdc++ -lwsock32
> -o client
> Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/specs
> gcc version 2.95.3-5 (cygwin special)
>  /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/collect2.exe -Bdynamic
> --dll-search-prefix=cyg -o client.exe /usr/lib/mingw/crt2.o
> -L/usr/lib/mingw -L/usr/lib/w32api
> -L/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5 MINGWdebug/libTCP.a
> ../../../../stlplus/source/MINGWdebug/libstlplus.a -lstdc++ -lwsock32
> -lmingw32 -lgcc -lmoldname -lmsvcrt -lmingw32 -luser32 -lkernel32
> -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmsvcrt
> /usr/lib/libstdc++.a(iostream.o)(.text+0x148):iostream.cc: undefined
> reference to `_imp___ctype_'
> /usr/lib/libstdc++.a(iostream.o)(.text+0x515):iostream.cc: undefined
> reference to `_imp___ctype_'
> /usr/lib/libstdc++.a(iostream.o)(.text+0x17b3):iostream.cc: undefined
> reference to `_impure_ptr'
> /usr/lib/libstdc++.a(iostream.o)(.text+0x17c4):iostream.cc: undefined
> reference to `_impure_ptr'
> /usr/lib/libstdc++.a(stdstrbufs.o)(.text+0x4e):stdstrbufs.cc: undefined
> reference to `_impure_ptr'
> /usr/lib/libstdc++.a(streambuf.o)(.text+0x3e3):streambuf.cc: undefined
> reference to `__errno'
> /usr/lib/libstdc++.a(fileops.o)(.text+0x19d):fileops.c: undefined
> reference to `__errno'
> /usr/lib/libstdc++.a(fileops.o)(.text+0x210):fileops.c: undefined
> reference to `__errno'
> /usr/lib/libstdc++.a(fileops.o)(.text+0x26d):fileops.c: undefined
> reference to `__errno'
> /usr/lib/libstdc++.a(fileops.o)(.text+0x398):fileops.c: undefined
> reference to `__errno'
> /usr/lib/libstdc++.a(fileops.o)(.text+0x45d):fileops.c: more undefined
> references to `__errno' follow
> /usr/lib/libstdc++.a(floatconv.o)(.text+0x1287):floatconv.c: undefined
> reference to `_imp____infinity'
> /usr/lib/libstdc++.a(floatconv.o)(.text+0x13e5):floatconv.c: undefined
> reference to `__errno'
> /usr/lib/libstdc++.a(iovfscanf.o)(.text+0x61):iovfscanf.c: undefined
> reference to `_imp___ctype_'
> /usr/lib/libstdc++.a(iovfscanf.o)(.text+0x8d):iovfscanf.c: undefined
> reference to `_imp___ctype_'
> /usr/lib/libstdc++.a(iovfscanf.o)(.text+0x55c):iovfscanf.c: undefined
> reference to `_imp___ctype_'
> /usr/lib/libstdc++.a(iovfscanf.o)(.text+0x5ac):iovfscanf.c: undefined
> reference to `_imp___ctype_'
> /usr/lib/libstdc++.a(iovfscanf.o)(.text+0x823):iovfscanf.c: undefined
> reference to `_imp___ctype_'
> /usr/lib/libstdc++.a(iovfscanf.o)(.text+0x87d):iovfscanf.c: more
> undefined references to `_imp___ctype_' follow
> collect2: ld returned 1 exit status
> make: *** [client] Error 1
>
> I have found definitions for __errno in libmsvcrt.a (so why is that
> failing?) but I cannot find any definitions of _imp___ctype_ in any of
> the libraries in /lib/mingw.
>
> Some version numbers in case they help:
>
> cygwin-1.3.3-2.tar.bz2
> gcc-2.95.3-5.tar.bz2
> mingw-runtime-1.1-1.tar.bz2
>
> Can anyone suggest what I'm doing wrong here?
>
> Andy
> ----------------------------------------------------------------------
> Andy Rushton, Senior Development Engineer
> LME Design Automation Ltd
> ----------------------------------------------------------------------
> This email and any files transmitted with it are confidential and may
> be legally privileged. It is intended solely for the use of the
> individual or entity to whom it is addressed. If you have received
> this in error, please contact the sender and delete the material
> immediately. LME Design Automation Ltd accepts no liability for any
> loss or damage which may be caused by software viruses or interception
> or interruption of this email, you should carry out your own virus
> check before opening any attachment.
> Any opinions expressed here are my own and not LME's.
> ----------------------------------------------------------------------
>
>
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
>
>


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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