Inactive code blocks

Sysprogs forums Forums VisualGDB Inactive code blocks

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #37327
    TerryR
    Participant

    I’m using VisualGDB for a Raspberry pi pico (CMake) project. My CMakeLists.txt file has multiple add_executable() sections, each to generate code to support a different hardware board variant using target_compile_definitions() statements.  The Solution Explorer shows each of the targets, and I select one to be the startup project. When I go to the editor, I see that the conditional code like… #if defined(SDCARD_SUPPORT)  sections are dimmed, and inactive for advanced features like “go to definition” or automatic code completion, etc. even though the CMake file defines this condition as ‘true’ for the current startup target. It seems to select conditional compile directives from a different  target. I assume this is an Intellisense function. I’ve gone through pages and pages of options, but I can’t find a setting that allows me to see all the compiled code for my specific target.

    Can anybody please show me how to do this?

    #37333
    support
    Keymaster

    Hi,

    This could a bit tricky. VisualGDB uses two-level approach when indexing sources:

    1. The solution can have one or more projects (top-level nodes in Solution Explorer, typically created by running the project wizard).
    2. Every project can have one or more targets (individual static libraries, executables, etc.).

    VisualGDB maintains a separate code index for each project, so it generally expects that every source file would only appear there once, regardless of the number of the underlying targets.

    If you want to work with multiple instances of the same file built with different flags, you would need to restructure your solution into multiple projects. Then VisualGDB would detect that the file is used by several projects, and would allow choosing one via a combo box in the top left corner of the editor. However, that would create some complications (e.g. you would have a separate set of configurations/debug settings for each project, and you would need to be careful with inter-project dependencies).

    Another option would be to have multiple build configurations (e.g. Debug-SDCard vs Debug-NoSDCard) and use CMake conditions to remove irrelevant targets from the configurations.

    #37335
    TerryR
    Participant

    Thank you for your response. Not quite the answer I had hoped for, but I’m willing to try anything.

    I think my least worse option is to convert the current single project with multiple targets into multiple projects, each with a single target –  if that will make the advanced IntelliSense features work!

    I think this might need a common source directory with separate sub-directories for each of the CMakeLists.txt and ./build subdirectories.

    I’ll give it a try ( after backing up my entire hard drive ).

    Thanks again.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.