Vscode-cpptools: c_cpp_properties.json compilerPath doesn't seem to look at Windows PATH environment variable

Created on 24 Jan 2019  路  3Comments  路  Source: microsoft/vscode-cpptools

Type: LanguageService

Describe the bug

  • OS and Version: Windows 10
  • VS Code Version: 1.30.2
  • C/C++ Extension Version: 0.21.0
  • Other extensions you installed (and if the issue persists after disabling them):
  • A clear and concise description of what the bug is.

Using just the .exe name of a compiler in compilerPath in c_cpp_properties.json causes it to fail. This has been happening since compilerPath was introduced. E.g. compilerPath: "g++"

image

Error in C/C++ Firmware Output window: Failed to query default include paths and defines for g++. WSL not detected

When I simply type g++ --version into a VSCode Powershell terminal, it works fine, so I have my PATH setup properly:

image


A more realistic example:
"compilerPath": "arm-none-eabi-g++ -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -specs=nosys.specs -specs=nano.specs -u _printf_float -u _scanf_float",

image

Failed to query default include paths and defines for arm-none-eabi-g++. WSL not detected

image

In Terminal: arm-none-eabi-g++ --version:

image

Feature Request Configuration Language Service fixed (release pending)

Most helpful comment

This is currently "by design", but given that we're looking to improve the configuration experience for our next release, this would be one way to help with that.

All 3 comments

This is currently "by design", but given that we're looking to improve the configuration experience for our next release, this would be one way to help with that.

It seems adding env variable support will not break anything but in some cases will help a lot.
Example: on my computer I have 2 versions of Visual Studio and 20 (twenty) versions of cl.exe compiler. Managing this with single PATH variable is impractical. I have to use distinct environment variables to store paths to x86, x64, ARM current version to avoid hardcoding.
Also, current behavior is inconsistent with other config files (tasks, launch etc.).

We implemented this feature with PR #5965. It currently available in our 0.30.0-insiders3 which you can install by changing the C_Cpp.updateChannel setting to "Insiders".

Was this page helpful?
0 / 5 - 0 ratings