This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Please help me passing a path to preprocessor
- From: jp dot guillemin at free dot fr
- To: Eljay Love-Jensen <eljay at adobe dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 25 Nov 2003 17:40:26 +0100
- Subject: Re: Please help me passing a path to preprocessor
- References: <5.2.1.1.0.20031125084004.00b9a8f0@iplan-mn.corp.adobe.com>
Hi Eljay, Mihnea,
Thank you for the solution,
For information I've found another one :
-DMYPATH=\"/usr/local/thepath\"
then the shell doesn't parse the " anymore
Regards
JP
Selon Eljay Love-Jensen <eljay@adobe.com>:
> Hi jp,
>
> If you are using MYPATH as a string in your source code, you may want to put
> double-quotes around it in the define in the makefile.
>
> -DMYPATH='"/usr/local/thepath"'
>
> Note that the single-quotes are chomped by the shell that the make spawns to
> launch the compiler.
>
> Another solution is to string-ize the MYPATH macro variable in your code
> via:
>
> #define STR_2(x) #x
> #define STR(x) STR_2(x)
>
> STR(MYPATH)
>
> The helper macro function STR_2 is necessary so the STR x parm gets expanded.
> Otherwise you'd end up with "MYPATH" instead of the expansion of MYPATH into
> /usr/local/thepath that you are hoping for, which STR_2 then stringifies.
>
> You may want to do this instead for STR_2...
>
> #define STR_2(x) L ## #x
>
> ...if you need to work with wchar_t strings instead.
>
> HTH,
> --Eljay
>
>
>