question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compiler flags containing spaces not passed correctly to IntelliSense

See original GitHub issue

Brief Issue Summary

Using custom CMake toolchain which is referenced in project-local kit .vscode\cmake-kits.json:

[
    {
      "name": "arm-gcc from CMake Toolchain",
      "toolchainFile": "${workspaceRoot}/cmake/arm-gcc-toolchain.cmake"
    }
]

Intellisense is configured via .vscode\settings.json to receive configuration from cmake-tools:

{
    "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
}

The cmake toolchain succeeds in locating the compiler and cmake-tools receives the compiler information, after I implemented the cmake cache workaround. The project build works as expected.

However, Intellisense C++ fails to locate the standard C library include files and marks the #include statements with squiggles.

The arm-gcc toolchain is on a Windows machine on a C:\Program Files (x86)\... path, thus containing a whitespace. When I move it to C:\arm-gnu-toolchain, eliminating the whitespace in the path, and reconfigure the project, then IntelliSense works and the affected #include files are found.

I assume the compiler path is not passed correctly from cmake-tools to IntelliSense, maybe there are quotes missing somewhere along the way.

Platform and Versions

  • Operating System: Windows
  • CMake Version: 3.17.4
  • VSCode Version: 1.48.0
  • CMake Tools Extension Version: 1.4.1
  • Compiler/Toolchain: arm-none-eabi-gcc 6.3.1.508

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
bobbrowcommented, Aug 21, 2020

This is perfect! Thanks for the logs. It looks like the problem is with this compiler flag: "--sysroot=C:/Program Files (x86)/GNU Arm Embedded Toolchain/9 2020-q2-update/bin/../arm-none-eabi". When it is passed to the compiler probe it messes things up because the path is not quoted.

1reaction
elahehrashedicommented, Jul 21, 2021

We will provide a VSIX soon with this fix so that you can test it with your scenario. I will update you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

IntelliSense issues with C++ on VS 2019 v16.11.6 or newer ...
When you open a source file (or run Rescan File) with this setting enabled, the Output window should have a Visual C++ Log...
Read more >
Visual Studio Code: how to add arguments for g++ compiler?
I'm confused by the setup in VSCode: why doesn't the runner use the same g++ compiler argument as used in VSCode's own terminal?...
Read more >
Visual Studio IntelliSense Not Working? What To Do.
If all of the above didn't work, it's time to verify some configurations in Visual Studio itself. Go to Tools -> Options ->...
Read more >
Modern Fortran for VS Code v3.1.0 Release - Announcements
If you are using $BUILD_DIR in your definition of of the paths VS Code will not be able to resolve the variable name...
Read more >
Understanding and Using Makefile Flags - Earthly Blog
Flags in make are just variables containing options that should be passed to the tools used in the compilation process.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found