From: khan AT xraylith DOT wisc DOT edu (Mumit Khan) Subject: Re: Which way to compile and link for mingw32 and iostreams 4 Dec 1998 01:38:40 -0800 Message-ID: <199812031726.LAA28624.cygnus.gnu-win32@modi.xraylith.wisc.edu> References: <19981203012832 DOT AAA19388 AT thanny> To: thanny AT home DOT com Cc: gnu-win32 AT cygnus DOT com thanny AT home DOT 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 AT cygnus DOT com" with one line of text: "help".