digitalmars.D.learn - Adding linker paths with spaces using dmd and msvc toolchain
- Jeremy DeHaan (10/10) Dec 29 2016 I have a path to where some .libs are, and this path has some
- Jerry (7/18) Dec 29 2016 The quotes get consumed by the command line. The way DMD spawns
- Jeremy DeHaan (2/11) Dec 29 2016 You mean I could do -L/LIBPATH:"""path"""?
- Ivan Kazmenko (8/20) Dec 30 2016 There is also the dark and dirty way of using the short DOS path,
- Jerry (6/18) Dec 30 2016 Yah you can try it with echo.
- Jerry (3/15) Dec 30 2016 My mistake that's for powershell, I'm not sure what the cmd.exe
- Jeremy DeHaan (4/9) Dec 30 2016 Does this happen on other platforms too? There has to be a GOOD
- Rainer Schuetze (3/11) Dec 30 2016 Not sure if it qualifies as "GOOD", but this works:
- Jeremy DeHaan (4/23) Dec 31 2016 Well, it's probably as good as it's going to get without dmd
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?
Dec 29 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.
Dec 29 2016
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:You mean I could do -L/LIBPATH:"""path"""?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.
Dec 29 2016
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: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.On Friday, 30 December 2016 at 03:51:13 UTC, Jeremy DeHaan wrote:You mean I could do -L/LIBPATH:"""path"""?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.
Dec 30 2016
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:Yah you can try it with echo. echo "test with space" prints: test with space echo """test with space""" prints: "test with space"On Friday, 30 December 2016 at 03:51:13 UTC, Jeremy DeHaan wrote:You mean I could do -L/LIBPATH:"""path"""?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.
Dec 30 2016
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:My mistake that's for powershell, I'm not sure what the cmd.exe way is.On Friday, 30 December 2016 at 03:51:13 UTC, Jeremy DeHaan wrote:You mean I could do -L/LIBPATH:"""path"""?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.
Dec 30 2016
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: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?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.
Dec 30 2016
On 30.12.2016 19:24, Jeremy DeHaan wrote:On Friday, 30 December 2016 at 04:56:59 UTC, Jerry wrote:Not sure if it qualifies as "GOOD", but this works: dmd -m64 "-L/LIBPATH:\"path with spaces\"" main.dOn Friday, 30 December 2016 at 03:51:13 UTC, Jeremy DeHaan wrote: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?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.
Dec 30 2016
On Friday, 30 December 2016 at 21:51:32 UTC, Rainer Schuetze wrote:On 30.12.2016 19:24, Jeremy DeHaan wrote:Well, it's probably as good as it's going to get without dmd looking for this specifically or having something added. Thanks.On Friday, 30 December 2016 at 04:56:59 UTC, Jerry wrote:Not sure if it qualifies as "GOOD", but this works: dmd -m64 "-L/LIBPATH:\"path with spaces\"" main.dOn Friday, 30 December 2016 at 03:51:13 UTC, Jeremy DeHaan wrote: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?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.
Dec 31 2016