public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* include fail with windows format in cygwin
@ 2021-07-22 10:00 Yeting Kuo
  2021-07-23  5:04 ` Jonathan Yong
  0 siblings, 1 reply; 2+ messages in thread
From: Yeting Kuo @ 2021-07-22 10:00 UTC (permalink / raw)
  To: gcc-help

Hi all,

I found that gcc 10.2.0 does not consider the source directory as include
path, when we use windows format like "C:\\tests\\x.c". I run it correctly
with gcc 5.4.0. I also have correct result with format "C://tests//x.c" and
"/cygdrive/c/tests/x.c" in gcc 10.2.0.

experiment:
$ ls "C:\\tests"
test.h  x.c
$ gcc -E "C:\\tests\\x.c" -o /dev/null
C:\tests\x.c:1:10: fatal error: test.h: No such file or directory
    1 | #include "test.h"
      |          ^~~~~~~~
compilation terminated.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: include fail with windows format in cygwin
  2021-07-22 10:00 include fail with windows format in cygwin Yeting Kuo
@ 2021-07-23  5:04 ` Jonathan Yong
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Yong @ 2021-07-23  5:04 UTC (permalink / raw)
  To: gcc-help

On 7/22/21 10:00 AM, Yeting Kuo via Gcc-help wrote:
> Hi all,
> 
> I found that gcc 10.2.0 does not consider the source directory as include
> path, when we use windows format like "C:\\tests\\x.c". I run it correctly
> with gcc 5.4.0. I also have correct result with format "C://tests//x.c" and
> "/cygdrive/c/tests/x.c" in gcc 10.2.0.
> 
> experiment:
> $ ls "C:\\tests"
> test.h  x.c
> $ gcc -E "C:\\tests\\x.c" -o /dev/null
> C:\tests\x.c:1:10: fatal error: test.h: No such file or directory
>      1 | #include "test.h"
>        |          ^~~~~~~~
> compilation terminated.
> 

Don't do that, Windows paths are not supported for Cygwin. You may argue 
"it used to work" or "it works sometimes" but it doesn't change the fact 
that it is not supported and will never be.

A blackslash is a valid character for filenames in the environment 
Cygwin is attempting to emulate, no attempts will be made to introduce 
extra logic in gcc for a feature that isn't supported on Cygwin.

If you need to use gcc with windows paths, use the mingw hosted gcc 
built natively for Windows.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-23  5:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-22 10:00 include fail with windows format in cygwin Yeting Kuo
2021-07-23  5:04 ` Jonathan Yong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).