Author Topic: building .exe files for DOS vs. Cygwin shell  (Read 6249 times)

Mike H

  • Community Member
  • Posts: 26
  • Hero Points: 3
building .exe files for DOS vs. Cygwin shell
« on: June 15, 2007, 11:21:10 PM »
Does anyone know a way to build an executable that works in a DOS shell WITHOUT having \cygwin\bin in the path?  I need two separate shell environments on my PC - DOS and Cygwin.  I build the simple "Hello World" project that ships with SE and it works (i.e. executes) in a Cygwin window.  When I run it in a DOS shell I'll get the famous "cygwin1.dll not installed" error since I don't have \cygwin\bin as part of my DOS path.  (obviously, it is part of my Cygwin path.).  So I need to be able to build the executable from within SE, be able to debug with GDB within SE, and have the executable, well, execute in a DOS shell.  Is this doable?  Any advice?

I'm using SE 12.01.  The project was created using the GNU C wizard starting with the "Hello World" app.
I have SE auto-generate and maintain the makefile.  The build command line explicitly calls c:\cygwin\bin\make since the path doesn't exist in DOS.  Compile is done with gcc.

thanks,
Mike

Phil Barila

  • Senior Community Member
  • Posts: 745
  • Hero Points: 61
Re: building .exe files for DOS vs. Cygwin shell
« Reply #1 on: June 16, 2007, 12:20:07 AM »
You are building a cygwin binary, because you are using the cygwin gcc to compile and link.  If you need a real DOS (16 bit real mode) executable, use DJGPP as your gcc.

twoods

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
Re: building .exe files for DOS vs. Cygwin shell
« Reply #2 on: June 18, 2007, 05:19:55 PM »
Does anyone know a way to build an executable that works in a DOS shell WITHOUT having \cygwin\bin in the path?

Try using the '-mno-cygwin' option for Cygwin gcc.  This will cause the Cygwin compiler to use the native Windows libraries.  You'll probably need to install the gcc mingw32 related packages from Cygwin if you haven't already done so.  Also, this won't work if you're using a UNIX-y call that's only implemented via the Cygwin DLL.

-Tim

Mike H

  • Community Member
  • Posts: 26
  • Hero Points: 3
Re: building .exe files for DOS vs. Cygwin shell
« Reply #3 on: June 19, 2007, 08:36:52 PM »
thanks for the tips guys.  I think I just need to remember to run the .exe in a cygwin shell.  I may update to the mingw32 packages at a later date, but I found a workaround for my case where I can run all my .exe files created with gcc in a cygwin shell.

-Mike