Skip to content

compilerPath setting of c_cpp_properties.json no longer supports batch files #3428

@smhc

Description

@smhc

Type: LanguageService

Describe the bug

  • OS and Version: Windows 10
  • VS Code Version: 1.33.0
  • C/C++ Extension Version: 0.22.1

compilerPath setting of c_cpp_properties.json no longer supports batch files (.bat). Earlier versions did support these. Using "cmd /C call xx.bat" works, however it is not possible to pass "${workspaceFolder}" as an argument.

Using a batch file results in the misleading error:
Failed to spawn process. Error: 2 (The system cannot find the file specified.)

To Reproduce

Use a c_cpp_properties.json file with a setting of:

"compilerPath":  "${workspaceFolder}\\test.bat"

or:

"compilerPath": "C:\\Windows\\System32\\cmd.exe /C echo ${workspaceFolder} >> %TEMP%\\cmd.log"

Expected behavior

Either the batch file can be launched directly, or at least make it possible to pass the 'workspaceFolder' as an argument to cmd to launch a batch file.

Additional context

The reason I wish to launch a batch file from the workspace folder is I want to have a 'dummy compiler' included as part of the project. This dummy compiler just returns the include paths and defines etc as gcc/g++ would. I use this technique for remote development from windows to linux with 'correct' intellisense.
However recent versions of vscode/cpptools have blocked this ability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Language ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.quick fixregressionA bug that didn't exist in a previous release

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions