Curious
Curious

Reputation: 494

CYGWIN Ms-Dos path detected warning

I am using Windows, i have a c file on my desktop. It includes unix code. When i write "gcc -o MyExe C:/Users/Username/Desktop/ccode.c" on cygwin terminal, it gives a warning like "MS-DOS path detected". How should i write it?

Upvotes: 0

Views: 709

Answers (1)

Keith Thompson
Keith Thompson

Reputation: 263177

Cygwin remaps Windows-style paths to a UNIX-compatible format, using / rather than \ as a directory separator (though Windows also accepts /), and putting all the drive letters into a virtual directory called /cygdrive.

Change this:

gcc -o MyExe C:/Users/Username/Desktop/ccode.c

to this:

gcc -o MyExe /cygdrive/C/Users/Username/Desktop/ccode.c

Cygwin also gives you a UNIX-style home directory. For a typical Cygwin installation, that directory will be at C:\cygwin\home\username as seen from Windows, or at /home/username as seen from Cygwin (also visible at /cygdrive/cygwin/C/home/username). As on actual UNIX/Linux systems, you can refer to your home directory as $HOME or ~ in many contexts. It's usually distinct from your Windows home directory C:\Users\username. I usually ignore the Windows home directory and just use my Cygwin home directory. But if you prefer you can certainly use your Windows home directory from Cygwin; it will just be a little harder to refer to it (and some file have to be in your Cygwin home directory.)

It might be possible to configure Cygwin to use your Windows home directory as your Cygwin home directory; I haven't tried it myself, and it might cause problems.

Upvotes: 1

Related Questions