Subject: Re: Which way to compile and link for mingw32 and iostreams
From: [email-masked] (Mumit Khan)

4 Dec 1998 01:38:40 -0800
Message-ID: <[email-masked]>
References: <19981203012832.AAA19388@thanny>
To: [email-masked]
Cc: [email-masked]

[email-masked] 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
"[email-masked]" with one line of text: "help".