Menu

#674 Codeblocks can not use variables with spaces in the “Compiler’s installation directory” setting

Undefined
invalid
nobody
None
Bug_Report
2018-04-29
2018-04-27
New Pagodi
No

When you try to use a compiler variable whose values contain spaces in the compiler’s installation directory area on the toolchain executables page of the compiler settings dialog, the resulting commands for the compiler, resource compiler, and linker will fail to execute.

For example, if I have

  1. defined the compiler variables:
    VCROOT=”C:\Program Files\Microsoft Visual Studio 2017\VC\Tools\MSVC”
    VCVERSION=14.13.26128
  2. set the compilers installation directory to $(VCRoot)\$(VCVersion)\bin\Hostx64\x64
  3. the C++ compiler is cl.exe

then the command codeblocks will try to execute to compile a file is

"C:\Program Files\Microsoft Visual Studio 2017\VC\Tools\MSVC"\14.13.26128\bin\Hostx64\x64\cl.exe

Because that command is partially quoted and partially unquoted, windows does not recognize it as a valid command. Codeblocks gives the following error message:

Project/Target: "test - Debug":
The compiler's setup (Microsoft Visual C++ 2017) is invalid, so Code::Blocks cannot find/run the compiler.
Probably the toolchain path within the compiler options is not setup correctly?!
Do you have a compiler installed?
Goto "Settings->Compiler...->Global compiler settings->Microsoft Visual C++ 2017->Toolchain executables" and fix the compiler's setup.

Tried to run compiler executable '"C:\Program Files\Microsoft Visual Studio 2017\VC\Tools\MSVC"\14.13.26128\bin\Hostx64\x64/bin/cl.exe', but failed!

Skipping...

Discussion

  • bluehazzard

    bluehazzard - 2018-04-27

    Ok, in the forum i was thinking this is a replace macro bug, but now i am not sure anymore...

    VCROOT=”C:\Program Files\Microsoft Visual Studio 2017\VC\Tools\MSVC” 
    

    are you using the variable with the " " ?
    You should not use them before the replacing...
    If you want to use qutation you have to use them outside the macro name... There is no logic to fix quatation in macros, because this was not the only intetion for macros...

    So in your example

    VCROOT=C:\Program Files\Microsoft Visual Studio 2017\VC\Tools\MSVC
    
    $(VCRoot)\$(VCVersion)\bin\Hostx64\x64
    

    spaces ?should? not be a problem here...

    can you try it?

     
    • New Pagodi

      New Pagodi - 2018-04-27

      You're right, taking out the quotes in the variable definitions does work. However when you try to enter a variable with spaces, a warning dialog pops up asking:

      The value contains spaces or strange characters. Do you want to quote it?

      I guess that made me think those variables should be quoted and I never tried it without quoting them. Sorry about that.

      So this ticket is invalid and can be closed. The other ticket about the incorrect warning at start up still applies though.

       
  • Teodor Petrov

    Teodor Petrov - 2018-04-29
    • status: open --> invalid
     

Log in to post a comment.

MongoDB Logo MongoDB