On 1/15/2023 4:38 AM, Alexander Grund via Cygwin wrote:
Hi,
consider the following MWE:
|$ touch bar/foo.h $ cat bar/main.cpp #include "foo.h" int main(){} With this most simple setup
calling GCC with `g++ "bar\main.cpp"` results in GCC failing to find the include file. However
using `g++ "bar/main.cpp"` works as expected. |
|So the compiler does find the CPP file and also is able to resolve others paths passed
with backslashes (e.g. -I arguments) but basically disables resolving includes relative
to the file including it. For context: This turned up on CI for Boost where
"|C:\cygwin64\bin" is added to the PATH env variable to be able to use the
Cygwin GCC with B2. The build system, finding it is running on Windows, will pass paths
with backward slashes to the compiler. This happens on both CMD with the added PATH and
using the bash. For reference I tried the same with MinGW and there either path separator
worked. So it seems to be an issue in the Cygwin builds of GCC. I tried both 11.2 and
11.3, the latest currently available. Best Regards, Alexander Grund ||
Backslash has a special meaning in C/C++ strings (the quote/escape
character). There's some kind of special magic in Cygwin bash that lets
you use most backslashes in paths without escaping them, but ordinarily
(outside of '-quotes) on UNIX/Cygwin you need to. If you use:
g++ bar\\main.cpp
or:
g++ "bar\\main.cpp"
or:
g++ 'bar\main.cpp'
it'll work.
--
Dan Harkless
http://harkless.org/dan/
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple