Skip to content

Can't identify an enum as a type #2086

Closed

Description

@metropt

As you can see on the following image it can't identify an enum as a type name. Is this the expected behavior on this version of the plugin?

image

Activity

  1. sean-mcmanus commented on Jun 4, 2018

    @sean-mcmanus
    Contributor

    UPDATE: Ignore what I wrote, see Bob's comment :)

    It's not expected in general. What is the squiggle in the enum definition? I assume it can't find the values used to define the enum, so that appears to be causing the type to not get defined. Can you get those values to be defined?

  2. bobbrow commented on Jun 4, 2018

    @bobbrow
    Contributor

    Which of the include files listed in main.c includes nrf_gpiote.h? From your screenshot, I can't tell whether nrf_gpiote.h is actually included in the translation unit.

    This should work, even with the squiggles in the enum value definitions.

    image

  3. metropt commented on Jun 9, 2018

    @metropt
    Author

    Bob Brown (@bobbrow) main.c include nrf_drv_gpiote.h and it include nrf_gpiote.h

    image

    BTW on the main.c file I can't navigate to included files except the ones from the compiler path or the ones I have opened on the editor.

  4. metropt commented on Jun 9, 2018

    @metropt
    Author

    How can I tell intellisense that a variable is defined?
    image
    I can share the project if it easier.

  5. sean-mcmanus commented on Jun 11, 2018

    @sean-mcmanus
    Contributor

    You should set the "defines" property in your c_cpp_properties.json. Setting your compilerPath should set your compiler-based defines (excluding cl.exe).

    Inability to navigate to the included files usually means your browse.path isn't set correctly (i.e. it should have ${workspaceFolder} and any other root folders where you need file navigation or workspace symbols).

  6. bobbrow commented on Jun 11, 2018

    @bobbrow
    Contributor

    José Xavier (@metropt), your latest screenshot shows that __APPLE__ is defined. The other (inactive) blocks are grayed out. If you are able to share your project, we can investigate further.

  7. metropt commented on Jun 11, 2018

    @metropt
    Author

    Bob Brown (@bobbrow) APPLE is a system variable but NRF51 isn't one. I'm going to try Sean McManus (@sean-mcmanus) advice tonight.

    Should I use relative paths or it's fine to use absolute paths?

  8. bobbrow commented on Jun 11, 2018

    @bobbrow
    Contributor

    What I'm implying is that setting NRF51 won't do anything for this particular header file because you're already going through the __APPLE__ path, not the #else path. But maybe it matters elsewhere, so it might still be worth a try.

  9. metropt commented on Jun 11, 2018

    @metropt
    Author

    Bob Brown (@bobbrow) you're right, I looked at it as two conditions blocks -.-' There is a way to undefined the __APPLE__ variable for this project on vscode?

  10. bobbrow commented on Jun 11, 2018

    @bobbrow
    Contributor

    Unfortunately, not at this time. Cross-compilation support is on the backlog, but not currently available.

  11. metropt commented on Jun 11, 2018

    @metropt
    Author
  12. bobbrow commented on Jun 11, 2018

    @bobbrow
    Contributor

    If you share the project, I can see if there's anything I can do for the time being. You can also try the forcedInclude property in c_cpp_properties.json to force include any of those nrf headers that end up missing.

  13. metropt commented on Jun 11, 2018

    @metropt
    Author

    https://www.dropbox.com/s/e9yhqq56vqr59yr/vscodecpp.zip?dl=0 the only thing I didn't include was arm gcc embedded.

    Thank you

  14. bobbrow commented on Jun 12, 2018

    @bobbrow
    Contributor

    Thanks. The forcedInclude property seems to do the trick for me.

                "forcedInclude": [
                    "${workspaceFolder}/../nRF5_SDK_12.3.0_d7731ad/components/device/nrf51.h",
                    "${workspaceFolder}/../nRF5_SDK_12.3.0_d7731ad/components/device/nrf51_bitfields.h",
                    "${workspaceFolder}/../nRF5_SDK_12.3.0_d7731ad/components/device/nrf51_deprecated.h"
                ]
    

    I also saw an invalid path in your "includePath" array. You should remove that or switch to recursive includes "${workspaceFolder}/../nRF5_SDK_12.3.0_d7731ad/**". We improved the performance of recursive includes in 0.17.5-insiders, with further improvements coming in 0.17.5.

    You can also remove the system include paths from "includePath" since you have specified the "compilerPath" property. My final c_cpp_properties.json looks like this:

    {
        "configurations": [
            {
                "name": "Mac",
                "browse": {
                    "path": [
                        "${workspaceFolder}/.."
                    ],
                    "limitSymbolsToIncludedHeaders": true
                },
                "includePath": [
                    "${workspaceFolder}",
                    "${workspaceFolder}/../nRF5_SDK_12.3.0_d7731ad/**",
                    "${workspaceFolder}/config"
                ],
                "defines": [],
                "compilerPath": "/usr/local/bin/arm-none-eabi-gcc",
                "cStandard": "c11",
                "cppStandard": "c++17",
                "intelliSenseMode": "clang-x64",
                "forcedInclude": [
                    "${workspaceFolder}/../nRF5_SDK_12.3.0_d7731ad/components/device/nrf51.h",
                    "${workspaceFolder}/../nRF5_SDK_12.3.0_d7731ad/components/device/nrf51_bitfields.h",
                    "${workspaceFolder}/../nRF5_SDK_12.3.0_d7731ad/components/device/nrf51_deprecated.h"
                ]
            }
        ],
        "version": 4
    }
    
  15. bobbrow commented on Jun 12, 2018

    @bobbrow
    Contributor

    And for reference, the cross-compiler support issue is #1083. Please go upvote that issue if you would like to bump up the priority.

  16. metropt commented on Jun 12, 2018

    @metropt
    Author

    thank you for your help :) at least now I can navigate through the whole code!

  17. locked and limited conversation to collaborators on Oct 14, 2020
  18. sean-mcmanus commented on Feb 3, 2021

    @sean-mcmanus
    Contributor

    José Xavier (@metropt) __APPLE__ can be undefined now with https://github.com/microsoft/vscode-cpptools/releases/tag/1.2.0 via changing the intelliSenseMode to something like "linux-gcc-x64", however, it may not solve your scenario, not sure -- we define unix and __unix__ on Linux, but not __unix. We're tracking some "unknown" platform with #6813 .

  19. unlocked this conversation on Feb 3, 2021
  20. locked and limited conversation to collaborators on Feb 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions