Page 1 of 1

Can't use environment variables with backslashes

Posted: Sat Sep 30, 2017 12:28 pm
by Dmitri
I'm using CodeLite 10.0.7 on Windows 10, with mingw-64 compiler.
I have an environment variable where some path is stored, let's say,

Code: Select all

MY_VAR = D:\My\Var
Notice it uses '\' backslashes
When I use this variable inside project settings, let's say, I use it in intermediate directory path:

Code: Select all

$(MY_VAR)\obj
Note: CodeLite will rename this to $(MY_VAR)/obj
, I'm getting error on linking:

Code: Select all

.../mingw-w64/mingw32/bin/ar.exe: D:MyVar/Main.cpp.o: No such file or directory
Notice that backslashes were removed from the path (D:MyVar) at some point.

That's not normal, right? Can it be fixed?

Re: Can't use environment variables with backslashes

Posted: Sun Oct 01, 2017 12:10 pm
by eranif
I don't think it's CodeLite which does that, but rather "Make"
Can you check the generated makefile and see how it was passed to it?
I am guessing that it will be as you wrote it (D:\My\Var)

You have 2 options here:
- Use double backslashes ("\\")
- Use forward slash ("/") - Windows can work with both forward-slash and backslash

Re: Can't use environment variables with backslashes

Posted: Wed Oct 04, 2017 2:19 am
by Dmitri
Yes, it looks like it's fine in .mk file:

Code: Select all

IntermediateDirectory  :=$(MY_VAR)/obj
Also, it doesn't happen (i.e. I can compile just fine) if I disable "Pass object list to linker via file" option. So I guess these backslashes are removed while writing/reading object filenames to that additional file. Can you check this?

Re: Can't use environment variables with backslashes

Posted: Wed Oct 04, 2017 6:41 am
by eranif
can you please pay the entire makefile?

also, there is a file with the name <project-name>.txt, can you also paste its content?