Variables wrongly underlined

Sysprogs forums Forums VisualGDB Variables wrongly underlined

This topic contains 3 replies, has 2 voices, and was last updated by  support 2 weeks, 2 days ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #25733

    prodey
    Participant

    Hello,

    I am using visualgdb version 5.4R12 (build 3242) for a STM32 project with Visual Studio 2019. I recently installed these tools on a new computer. When I open an existing project, viaualgdb underlines several variables in a .c file and not able to navigate to that variable. These variables are declared in other files that are included in the .c file. Surprisingly, the project compiles and executes without any errors.

    In the attached file, the red underlined global variables like CAN_HandleTypeDef are defined in canComm.h. The project compiles and runs without any issues.

    I tried restarting, re-installing everything etc, but no help. This is very irritating.

    Please suggest how to get rid of this bug.

    Attachments:
    You must be logged in to view attached files.
    #25748

    support
    Keymaster

    Hi,

    No problem, we can help you troubleshoot this. Please check that the Errors window does not show any other IntelliSense errors that could explain why Clang IntelliSense is not able to parse the type definitions. If it doesn’t help, please try the following:

    1. Try closing the project, deleting the CodeDB subfolder and reopening it.
    2. If it doesn’t help, please locate the definition of CAN_HandleTypeDef and check if it’s surrounded by any #ifdef blocks. If the #ifdef block appears inactive, please check where the macro controlling it is defined. It might be manually defined in the build settings in a way that doesn’t get passed to the IntelliSense (normally, please use the VisualGDB GUI to edit preprocessor macros for the project as it will automatically update IntelliSense).
    3. If the #ifdef block is active, please try copying it to the .c file directly. If it resolves the problem, please try copying it to a separate .h file and try including this file from different parts of the .c file. If there is any particular place in the .c file after which the included file stops working, it could be a bug triggered by some previously defined code. In that case, please let us know more details and we will help you track it further down.
    #25760

    prodey
    Participant

    Hello,

    Thanks for the reply. It turned out that the definition of CAN_HandleTypeDef was getting masked by another #ifdef . I defined that macro through the project properties now and the underlines are gone. This is quite strange since the exact same project was working without any underlines on the same PC before I had to format it. Also, I was expecting a compilation error if these definitions are not compiled due to the ‘#ifdef’ed code. But there was no build or runtime error.

    Anyways, I have a working solution now. Thanks.

    #25762

    support
    Keymaster

    Good to know it works. For older project types (e.g. GNU Make), the IntelliSense compilation settings are computed separately from the build settings (as GNU Make doesn’t automatically report the build flags in a structured way) and hence editing some settings manually instead of using the VisualGDB GUI might get IntelliSense out-of-sync with the actual build.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.