This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: Which way to compile and link for mingw32 and iostreams
- To: thanny at home dot com
- Subject: Re: Which way to compile and link for mingw32 and iostreams
- From: Mumit Khan <khan at xraylith dot wisc dot edu>
- Date: Thu, 03 Dec 1998 11:26:29 -0600
- cc: gnu-win32 at cygnus dot com
thanny@home.com writes:
> I'm attempting to compile my C++ program into a Win32 console executable
> (already have DOS, DPMI, and OS/2 done), and have run into something of a
> snag.
>
> I need to use the following non-standard C library functions:
>
> _kbhit()
> _getch()
> _strrev()
> _itoa()
>
> I also want the executable to be independant of any Cygwin files.
>
> If I compile with -mno-cygwin, then __CYGWIN__ isn't defined, and the
> preprocessor doesn't include the headers in the mingw32 directory.
>
> If I compile without it, using the headers in the mingw32 directory, I run
> into problems linking with the -mno-cygwin switch. Specifically,
> undefined references, such as this:
I have written on this topic before, so I won't go into details again.
Basically, you need the mingw32 version of libstdc++ before you can use
Cygwin b20 GCC to be able to build C++ code.
Cygwin b20 comes with cygwin target libraries, and you can't simply link
against those even if you specify -mno-cygwin. The libraries of interest
are:
- libstdc++.a << affects almost non-trivial C++ code
- libiberty.a << if you want getopt etc.
An easy way is to get these out of my binary distribution for mingw32 and
use -L/path/to/mingw32/libraries option in addition to -mno-cygwin.
Regards,
Mumit
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".