Can't use environment variables with backslashes

General questions regarding the usage of CodeLite
Dmitri
CodeLite Curious
Posts: 2
Joined: Sat Sep 30, 2017 12:06 pm
Genuine User: Yes
IDE Question: C++
Contact:

Can't use environment variables with backslashes

Post 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?
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Can't use environment variables with backslashes

Post 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
Make sure you have read the HOW TO POST thread
Dmitri
CodeLite Curious
Posts: 2
Joined: Sat Sep 30, 2017 12:06 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Can't use environment variables with backslashes

Post 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?
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Can't use environment variables with backslashes

Post 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?
Make sure you have read the HOW TO POST thread
Post Reply