NCS 1.8 VS Code #Include Errors

Today I opened VS Code to find all my Zephyr/NRF #includes have the red squiggly lines with an error such as "cannot open source file zephyr/types.h". Right click -> Go to Definition also does not work for these includes. The same thing happens in all my projects. Build and Pristine Build work fine to build the program but do not resolve this problem. I suspect there was a VS Code or extension related update that broke the Intellisense? Any help is appreciated.

Potentially related, sometimes projects randomly will not build with the error seen below. Reopening VS Code fixes this.

Parents
  • Not sure if this is the correct way, but I've fixed this by doing the following:

    -right clicking on the error and selecting the "add include path" option (this creates a c_cpp_properties.json file inside a .vscode folder)

    -open the json file, under "includePath" there should be a path to your SDK location "ncs/v1.8.0/zephyr/include"

    -still in this json file, change "configurationProvider" from the default value to "nrf-connect"

    Interesting to note, the .vscode folder and c_cpp_properties.json did not exist in my projects before which never had this problem, so I assume there was an update that now requires you to have this file setup.

  • So... I am complete newbie here and was having the same issue so I edited the c_cpp_configurations.json file to have the correct include path and edited the configuration Provider to be "nrf-connect". But now I am getting a compiler error. How do I know which compiler I should be pointing to in the c_cpp_configurations.json file and where in the SDK that executable is located? Just forreference I am following the devacademy instructions and am on lesson 2 exer 1. I got the blinks example to work the first time and now I can't get it to work because of these include and compiler errors... I am a bit frustrated at the moment so any tips are greatly appreciated. I am using an nrf52840 dongle.

Reply
  • So... I am complete newbie here and was having the same issue so I edited the c_cpp_configurations.json file to have the correct include path and edited the configuration Provider to be "nrf-connect". But now I am getting a compiler error. How do I know which compiler I should be pointing to in the c_cpp_configurations.json file and where in the SDK that executable is located? Just forreference I am following the devacademy instructions and am on lesson 2 exer 1. I got the blinks example to work the first time and now I can't get it to work because of these include and compiler errors... I am a bit frustrated at the moment so any tips are greatly appreciated. I am using an nrf52840 dongle.

Children
No Data
Related