Which way to compile and link for mingw32 and iostreams

thanny@home.com thanny@home.com
Wed Dec 2 23:29:00 GMT 1998


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:

/libstdc++.a(iostream.o)(.text+0x113):iostream.cc: undefined reference to
`_ctype_' /libstdc++.a(iostream.o)(.text+0x195d):iostream.cc: undefined
reference to `_impure_ptr'
/libstdc++.a(streambuf.o)(.text+0x34c):streambuf.cc: undefined reference
to `__errno' /libstdc++.a(stdiostream.o)(.text+0x14e):stdiostream.cc:
undefined reference to `__srget' collect2: ld returned 1 exit status

I snipped the path information from the front, and only included one of
each error, from multiple instances.

So, how do I compile and link with the mingw32 libraries, without breaking
iostreams?

My feeling is that I need to compile with the -mno-cygwin switch, and if
that's the case, I need to know which define to check for the Cygwin
compiler, so that I include the mingw32 headers instead of the standard
ones.

I appreciate any assistance.

- Mike

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list