Clang Intellisense: Undeclared identifier

Sysprogs forums Forums VisualGDB Clang Intellisense: Undeclared identifier

Tagged: 

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #29303
    Gast
    Participant

    I have a function

    void setADCs()

    In the line where it is called

    setADCs()

    the call is marked as Error: Clang Intellisense “use of undeclared identifier” or,

    when looking for the definition: “The selected location does not refer to a C/C++ entity”

    This also happens to any other function.

    The code however runs and debugs as expected.

    Is this just because something is missing in Clang?

     

    #29362
    support
    Keymaster

    Hi,

    Unfortunately, we were not able to reproduce the problem based on the description you provided.

    If VisualGDB behaves differently than you expect, please share the complete steps to reproduce the problem from scratch per our problem reporting guidelines and we will try to investigate this further.

    #29378
    Gast
    Participant

    After restarting this was fixed.

    #29462
    Gast
    Participant

    Problem came back. Example:

    This shows the error ” Clang Intellisense “use of undeclared identifier”” when calling test().

    void setup() { pinMode(LED_BUILTIN, OUTPUT); } void loop() {test(); digitalWrite(LED_BUILTIN, HIGH); delay(1000); digitalWrite(LED_BUILTIN, LOW); delay(1000); } void test() { int x = 9; }

    When the function test() is moved above loop() the error is not shown.

    Do functions need to be put in front of loop()?

    #29463
    Gast
    Participant

    Update:

    I found out by chance that after creating the VisualGDB project from an Arduino .ino file the error always shows up.

    However, when I open the vcxproj file again it is ok.

    This is quite confusing since I was used to start the project usually from the Arduino file instead from the vcxproj file that drives me into Visualmicro which I have also installed. Visualmicro has to be disabled to run the project in VisualGDB by loading the vcxproj file.

     

     

    #29464
    Gast
    Participant

    No, it works only for the small blink sketch.

    For my large project reloading the sln file does not help. On all  functions errors ( “The selected location does not refer to a C/C++ entity”).

    Many more errors like undeclared identifiers, though the program will run correctly.

     

     

     

     

    #29465
    support
    Keymaster

    Thanks for your feedback. We have added it to our internal issue tracker and will investigate it further if the issue is confirmed by other users.

    #29466
    Gast
    Participant

    Solved:

    The nightmare has ended after several days of trials (and hopefully persistent):

    I changed Intellisense Settings to “Clang-format (advanced)” and the functions etc. were recognized correctly.

     

    #29467
    Gast
    Participant

    Sorry, the nightmare had not ended…

    After restarting Visualstudio the intellisense errors popped up again. I tried to remember how I fixed it previously, but I had no success anymore.

    The solution then was to painfully reorder the function definitions so that each of them was located on top of a corresponding call, i.e. putting the functions behind the definitions in the “correct” sequential calling order.

    Now it seems to work even after restarting Visualstudio….

    Can anyone tell me why intellisense under certain (unknown to me) circumstances does not recognize function calls when the function is declared behind the call? Arduino does not require that.

    #29468
    support
    Keymaster

    Please note that we prioritize the reported issues based on the amount of affected users. As this issue does not affect other users, we will not be able to provide any further help with it. If you are not able to continue your VisualGDB trial due to it, please consider using other tools as we will not be able to address it at this point.

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