This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Can't find includes in Visual Studio Code

Hello! 

I've got a small problem in Visual Studio Code for Windows, the intellisense can't seem to find the nordic header files from the downloaded sdk. It compiles just fine, its the intellisense that is complaining. I've added the C/C++ extension to Visual Studio Code and configured the C/C++ configuration (c_cpp.properties.json) - or so I thought! 

the intellisense can't find multiple files, for instance nrf.h. That file is located NRF_SDK/modules/nrfx/mdk and adding "${env:NRF_SDK}/modules/**" to includePath should do the trick?

env_NRF_SDK is just fine as opening %NRF_SDK% works in explorer.

{
    "configurations": [
        {
            "name": "nRF52832",
            "includePath": [
                "${workspaceFolder}/**",
                "${env:GNU_GCC}/arm-none-eabi/include",
                "${env:NRF_SDK}/modules/**",
                "${env:NRF_SDK}/components/**"
            ],
Parents
  • Hi,

    Did you open the whole project or just the file itself? Is VS able to open the file if you right-click and press "Go to definition"? I see that intellisense is indeed showing its error squiggles when a project is opened, but you should still be able to go to included files and definitions.

  • Thank you for your reply Jared!

    I've opened a folder and created a workspace in Visual Studio Code. I'm actually in ble_app_blinky example folder where I created the workspace.

    But I got it working, i had

    "${env:NRF_SDK}/components/**"
     
    but adding
    "${env:NRF_SDK}/components/softdevice/s132/headers"
    solves the problem. I thought components/** would do the trick, but maybe VSCode got confused and skipped them altogether since this file is in multiple folders? Strange. Intellisense is working now.
    Follow up; whats the difference for the header files in modules\nrfx folder and the softdevice folders?
Reply
  • Thank you for your reply Jared!

    I've opened a folder and created a workspace in Visual Studio Code. I'm actually in ble_app_blinky example folder where I created the workspace.

    But I got it working, i had

    "${env:NRF_SDK}/components/**"
     
    but adding
    "${env:NRF_SDK}/components/softdevice/s132/headers"
    solves the problem. I thought components/** would do the trick, but maybe VSCode got confused and skipped them altogether since this file is in multiple folders? Strange. Intellisense is working now.
    Follow up; whats the difference for the header files in modules\nrfx folder and the softdevice folders?
Children
No Data
Related