delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/12/03/05:50:05

From: thanny AT home DOT com
Subject: Which way to compile and link for mingw32 and iostreams
3 Dec 1998 05:50:05 -0800 :
Message-ID: <19981203012832.AAA19388.cygnus.gnu-win32@thanny>
To: gnu-win32 AT cygnus DOT com

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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019