Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Unresolved Symbols from Referenced Projects

Good evening everyone

 

I’m trying to track down an issue that might be related to this (presumably solved) bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=310837

 

I see unresolved symbols reported by codan, even after adding corresponding symbol declarations to headers in referenced projects.

 

My issue can be reproduced as follows:

-          Create a static library project

-          Add an empty header file (header.h) to the library project

-          (Optional to compile the lib project: add a lib.cpp file including the header)

-          Create an executable project

-          Add a dependency from the executable project to the library project

-          Add a source file containing a main function.

-          In the main function add a call to a function foo()

int main() {

  foo(); //Codan correctly reports an issue about the unresolved symbol

}

 

So far codan will complain about the unresolved function call foo() – as expected. Now if I add an include directive for header.h to main.cpp this will not change (as header.h does not contain a declaration of the foo function yet). However, I would expect this to change as soon as I add a declaration “void foo();” to header.h. Unfortunately, this does not change until I manually (1) rebuild the index, (2) freshen all files or (3) update the index with modified files.

 

I’m not sure whether this might be intended behavior due to performance reasons. However, I think there should be an option for the indexer not to ignore changes in dependent projects. Does anyone have a suggestion where to fix/implement this functionality or which action should trigger such a refresh?

 

I’m considering to attach it to the  “Index source and header files opened in editor”, maybe by adding an additional option to automatically update the index with modified files. Alternatively, updating the index of depending projects seems to be the right thing to do when changing a header file, but I’m quite sure whether that would be a smart approach regarding the performance.

 

Any input is welcome.

 

BR

Thomas


Back to the top