Sysprogs forums › Forums › VisualGDB › Intellisense may be Incorrectly flagging errors
- This topic has 2 replies, 2 voices, and was last updated 3 years ago by
GeneM.
-
AuthorPosts
-
January 14, 2023 at 13:05 #33698
GeneM
ParticipantA couple of lines in one of the files in my program are underscored with a red squiggly line indicating there’s an error. When I hover over the underscored text, I can see what Intellisense thinks the error is as shown in the attached screen shot. It doesn’t look like an error to me according to my understanding of std::string_view and the program compiles and runs just fine. Do I have something setup incorrectly?
Thanks
-
This topic was modified 3 years ago by
GeneM.
Attachments:
You must be logged in to view attached files.January 16, 2023 at 16:47 #33704support
KeymasterHi,
This typically happens for complex projects using custom toolchains – some of the implicit macros set by the compiler do not get properly passed to the VisualGDB’s IntelliSense engine, and prevent IntelliSense from finding the relevant function definitions in the headers.
In order to track it down, please follow the steps below:
- Isolate the problem to a minimal project with just one source file, one function (e.g. void test123() {…}) and as little #include<> directives as possible.
- Manually the actual definition of the missing method by searching the header files.
- Try opening that header file in Visual Studio and see if the relevant definition is grayed out. If it is, check for conditional statement (#if <…>) that could be blocking it.
- If you have found the relevant conditional statement (e.g. #ifdef SOME_FEATURE), you can manually pass it to the IntelliSense engine via VisualGDB Project Properties -> IntelliSense Settings -> Additional CFLAGS (the flag in this example would be -DSOME_FEATURE or -DSOME_FEATURE=123).
- If the statement is not grayed out, try moving the test() function directly in the header file, as close to the definition as possible. If it works from there, some code after the definition is interfering with IntelliSense. Moving the test123() function to different parts of the header file (or further down the #include<> stack) should help isolate the part causing the problem.
January 16, 2023 at 16:53 #33707GeneM
ParticipantThanks for the clues, this is almost for sure related to the fact this is a CMake project set up by somebody else. I did build a really simple MSBuild project in VGDB with the same code shown in that snip I attached. It worked just fine with no red error underscores. I think we’re good for now. Thanks again.
-
This topic was modified 3 years ago by
-
AuthorPosts
- You must be logged in to reply to this topic.