Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
December 30, 2016 Adding linker paths with spaces using dmd and msvc toolchain | ||||
---|---|---|---|---|
| ||||
I have a path to where some .libs are, and this path has some spaces in it. Using dmd and the msvc toolchain, I only seem to be able to correctly link .lib files if I pass them to the compiler with their full paths, or if I give the linker a relative path. When I add -L/LIBPATH:"path" to the command line, it ends up looking like this: -L/LIBPATH:"C:\Users\Jeremy DeHaan\Desktop\CODE\dsfml\lib". The linker will complain that it cannot open input file 'DeHaan\Desktop\CODE\dsfml\lib.obj'. How does one correctly add a linker path that has spaces? |
December 30, 2016 Re: Adding linker paths with spaces using dmd and msvc toolchain | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jeremy DeHaan | On Friday, 30 December 2016 at 03:51:13 UTC, Jeremy DeHaan wrote:
> I have a path to where some .libs are, and this path has some spaces in it. Using dmd and the msvc toolchain, I only seem to be able to correctly link .lib files if I pass them to the compiler with their full paths, or if I give the linker a relative path.
>
> When I add -L/LIBPATH:"path" to the command line, it ends up looking like this:
> -L/LIBPATH:"C:\Users\Jeremy DeHaan\Desktop\CODE\dsfml\lib".
>
> The linker will complain that it cannot open input file 'DeHaan\Desktop\CODE\dsfml\lib.obj'.
>
> How does one correctly add a linker path that has spaces?
The quotes get consumed by the command line. The way DMD spawns the linker by creating a new string with all the flags. So it smashes everything into a new string, ignoring how the string was passed into DMD. I think you can use triple quotes, """string with space""", and it should make the string passed to DMD include the string. Might be different for powershell.
|
December 30, 2016 Re: Adding linker paths with spaces using dmd and msvc toolchain | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jerry | On Friday, 30 December 2016 at 04:56:59 UTC, Jerry wrote:
> On Friday, 30 December 2016 at 03:51:13 UTC, Jeremy DeHaan wrote:
>> How does one correctly add a linker path that has spaces?
>
> The quotes get consumed by the command line. The way DMD spawns the linker by creating a new string with all the flags. So it smashes everything into a new string, ignoring how the string was passed into DMD. I think you can use triple quotes, """string with space""", and it should make the string passed to DMD include the string. Might be different for powershell.
You mean I could do -L/LIBPATH:"""path"""?
|
December 30, 2016 Re: Adding linker paths with spaces using dmd and msvc toolchain | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jeremy DeHaan | On Friday, 30 December 2016 at 05:24:56 UTC, Jeremy DeHaan wrote: > On Friday, 30 December 2016 at 04:56:59 UTC, Jerry wrote: >> On Friday, 30 December 2016 at 03:51:13 UTC, Jeremy DeHaan wrote: >>> How does one correctly add a linker path that has spaces? >> >> The quotes get consumed by the command line. The way DMD spawns the linker by creating a new string with all the flags. So it smashes everything into a new string, ignoring how the string was passed into DMD. I think you can use triple quotes, """string with space""", and it should make the string passed to DMD include the string. Might be different for powershell. > > You mean I could do -L/LIBPATH:"""path"""? There is also the dark and dirty way of using the short DOS path, which is still maintained on Windows file system partitions. How to get DOS path: http://stackoverflow.com/questions/4051088/how-to-get-dos-path-instead-of-windows-path I can't recommend it as a long-term solution, but it sure can help when one needs things working here and now. Ivan Kazmenko. |
December 30, 2016 Re: Adding linker paths with spaces using dmd and msvc toolchain | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jerry | On Friday, 30 December 2016 at 04:56:59 UTC, Jerry wrote:
> On Friday, 30 December 2016 at 03:51:13 UTC, Jeremy DeHaan wrote:
>> How does one correctly add a linker path that has spaces?
>
> The quotes get consumed by the command line. The way DMD spawns the linker by creating a new string with all the flags.
Does this happen on other platforms too? There has to be a GOOD way to pass a linker path that has spaces. Should this be considered as a bug?
|
December 30, 2016 Re: Adding linker paths with spaces using dmd and msvc toolchain | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jeremy DeHaan |
On 30.12.2016 19:24, Jeremy DeHaan wrote:
> On Friday, 30 December 2016 at 04:56:59 UTC, Jerry wrote:
>> On Friday, 30 December 2016 at 03:51:13 UTC, Jeremy DeHaan wrote:
>>> How does one correctly add a linker path that has spaces?
>>
>> The quotes get consumed by the command line. The way DMD spawns the
>> linker by creating a new string with all the flags.
>
>
> Does this happen on other platforms too? There has to be a GOOD way to
> pass a linker path that has spaces. Should this be considered as a bug?
>
>
Not sure if it qualifies as "GOOD", but this works:
dmd -m64 "-L/LIBPATH:\"path with spaces\"" main.d
|
December 30, 2016 Re: Adding linker paths with spaces using dmd and msvc toolchain | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jeremy DeHaan | On Friday, 30 December 2016 at 05:24:56 UTC, Jeremy DeHaan wrote:
> On Friday, 30 December 2016 at 04:56:59 UTC, Jerry wrote:
>> On Friday, 30 December 2016 at 03:51:13 UTC, Jeremy DeHaan wrote:
>>> How does one correctly add a linker path that has spaces?
>>
>> The quotes get consumed by the command line. The way DMD spawns the linker by creating a new string with all the flags. So it smashes everything into a new string, ignoring how the string was passed into DMD. I think you can use triple quotes, """string with space""", and it should make the string passed to DMD include the string. Might be different for powershell.
>
> You mean I could do -L/LIBPATH:"""path"""?
Yah you can try it with echo.
echo "test with space"
prints: test with space
echo """test with space"""
prints: "test with space"
|
December 30, 2016 Re: Adding linker paths with spaces using dmd and msvc toolchain | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jeremy DeHaan | On Friday, 30 December 2016 at 05:24:56 UTC, Jeremy DeHaan wrote:
> On Friday, 30 December 2016 at 04:56:59 UTC, Jerry wrote:
>> On Friday, 30 December 2016 at 03:51:13 UTC, Jeremy DeHaan wrote:
>>> How does one correctly add a linker path that has spaces?
>>
>> The quotes get consumed by the command line. The way DMD spawns the linker by creating a new string with all the flags. So it smashes everything into a new string, ignoring how the string was passed into DMD. I think you can use triple quotes, """string with space""", and it should make the string passed to DMD include the string. Might be different for powershell.
>
> You mean I could do -L/LIBPATH:"""path"""?
My mistake that's for powershell, I'm not sure what the cmd.exe way is.
|
December 31, 2016 Re: Adding linker paths with spaces using dmd and msvc toolchain | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rainer Schuetze | On Friday, 30 December 2016 at 21:51:32 UTC, Rainer Schuetze wrote:
>
>
> On 30.12.2016 19:24, Jeremy DeHaan wrote:
>> On Friday, 30 December 2016 at 04:56:59 UTC, Jerry wrote:
>>> On Friday, 30 December 2016 at 03:51:13 UTC, Jeremy DeHaan wrote:
>>>> How does one correctly add a linker path that has spaces?
>>>
>>> The quotes get consumed by the command line. The way DMD spawns the
>>> linker by creating a new string with all the flags.
>>
>>
>> Does this happen on other platforms too? There has to be a GOOD way to
>> pass a linker path that has spaces. Should this be considered as a bug?
>>
>>
>
> Not sure if it qualifies as "GOOD", but this works:
>
> dmd -m64 "-L/LIBPATH:\"path with spaces\"" main.d
Well, it's probably as good as it's going to get without dmd looking for this specifically or having something added. Thanks.
|
Copyright © 1999-2021 by the D Language Foundation