Adding linker paths with spaces using dmd and msvc toolchain

Jerry via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Dec 29 20:56:59 PST 2016


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.


More information about the Digitalmars-d-learn mailing list