Cannot context-open header files included in the project, clang engine

Sysprogs forums Forums VisualGDB Cannot context-open header files included in the project, clang engine

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #6790
    dmitryponv
    Participant

    I apologize for taking up forum space with several topics.

    I’ve a different issue with Intellisense, this is with VisualGDB 5.0 and VS2013.

    I tried using both Visual Studio Intellisense and Clang Intellisense,

    In both cases the engine will only recognize header files placed into the directory of the source file or in child directories of the source file. If there are header files in adjacent directories, the engine will not find them.

    The project compiles without issues, but I cannot use context-menu navigation or auto-completion. I cannot even right click on the header file and Open File, even though the file is included in the project.

    Is there a way to make Clang or Visual Studio Intellisense search all the header files in the project?

    Thank you
    -D

    #6791
    dmitryponv
    Participant

    As a temporary workaround for this, I used a command prompt command to list all directories within the project and add them individually to Project->Properties->Con figuration Properties->NMake under Intellisense Search Path

    The prompt command to save all directory names is dir /s /b /o:n /ad > list.txt

    However, this required me to add more than 50 directories, and this number constantly changes, I would need a better solution to have intellisense automatically recognize all header files in the project.
    This also doesn’t work very well,

    For example, if I have a Source.cpp file and a source.h file.

    In Source.h I will “#include ObjectClass.h” and define an ObjectClass ObjectA;

    In Source.cpp, which has “#include Source.h” I will use ObjectA.TestFunction();

    In Source.h I can right click on ObjectClass and it will display ObjectClass.h definition of that class

    However in Source.cpp, ObjectA appears as: error: this object class has no storage class or type specifier

    What could be wrong here, neither Visual Studio nor CLang Intellisese can pick up definitions in the included headers

    EDIT: After deleting *.sdf file inside the VS project directory, and restarting Visual Studio with CLang settings enabled, it started working a lot better,

    I still cannot have to include all the directories manually int he final project,

    Thanks,

    • This reply was modified 9 years, 4 months ago by dmitryponv.
    • This reply was modified 9 years, 4 months ago by dmitryponv.
    #6800
    support
    Keymaster

    Hi,

    Are Source.cpp, Source.h and ObjectClass.h in the same directory? If not, it is by design that IntelliSense only searches the include directories and not every possible directory.

    If you have imported a custom project, most likely your build system adds those directories to the include directory list explicitly, so build can find them. VisualGDB can only import those directories automatically if you are using VisualGDB-generated Makefiles (or CMake/QMake files) with known structure, otherwise you need to specify the include directories manually like you just did.

    #6824
    dmitryponv
    Participant

    Hi.

    They are not in the same directory, but I did include every folder in intellisense search list using the previous workaround.

    I am fine with this being a permanent solution,

    However this is the problem I am having:

    The header file (Test.h) includes a header for another class (ExampleClass.h)
    If I write a function in Test.h, I can get intellisense context for ExampleClass

    However, if I write that same function in Test.cpp, which includes Test.h, I cannot get the same Context from Intellisense.

    In other words, it seems that intellisense is not looking for context in header files included in the header file of the class being used.

    Thanks,

    #6826
    support
    Keymaster

    Hi,

    Not fully sure what you meant. Could you provide a simple example showing file contents and expected/observed IntelliSense suggestions?

    #6850
    dmitryponv
    Participant

    I already provided an example above.

    Here is another:

    When I have a header file “Class2.h” included in the header file “Class1.h”.

    In the cpp file “Class1.cpp” for that class I have a variable “Class2 myClass2”

    Although Class2 shows up green, I cannot right click on it to get to “Class2.h” header file

    Sometimes this works, and sometimes this doesn’t. It seems really buggy, and even when trying to get to the definition in the same header file, Clang Intellisense still has to parse the entire project.

    It seems Eclipse is way better at this,

    Thanks

    #6851
    support
    Keymaster

    Hi,

    We tried reproducing your example, but could not get anything to fail. Hence I would assume that the problem is caused by some detail omitted in your message (e.g. relative paths, some extra spaces or tabs, file name lengths). If you could send us an archive with the exact files that fail for you, we should be able to fix it fairly fast.

    Clang IntelliSense parses the entire project when:

    • You search for a definition (not declaration with Ctrl-F12) of a function that is not defined in the current translation unit.
    • The function is not static.

    If this happens in some other case, please give us an example file and we should be able to fix it quickly.

    We know that our IntelliSense engine has some bugs that are not present in Eclipse and that’s why we always ask for detailed repro steps that help us nailing down those bugs and fixing them. As long as we can reproduce the bug on our side, we typically release a hotfix within 24 hours. Hence if you could provide us with the exact file that causes the bugs on your side, most likely we will resolve it very fast.

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