Skip to main content
AT38
Associate II
March 18, 2021
Question

Refactor ignores header files. Why?

  • March 18, 2021
  • 3 replies
  • 1359 views

When I refactor a global variable or function from its definition in a source file, all instances are replaced except the declarations in the header files.

Attempting to refactor from the header file achieves nothing. The new name is immediately replaced with the original name.

This is not ideal.

Does anyone know why this might be happening? A bug, or a project configuration error?

Cheers.

This topic has been closed for replies.

3 replies

RDemb.1
Visitor II
March 19, 2021

Where this header files are located, in source folder or normal? indexer see this files?

Radosław
Associate II
March 19, 2021

Where this header files are located, in source folder or normal? indexer see this files?

AT38
AT38Author
Associate II
March 19, 2021

Sources are in `/module_name/src/`, headers are in `/module_name/inc/`

If I Ctrl-Click on a definition, it takes me to the corresponding declaration in the header file. Likewise, Ctrl-Tab will take me to the header file for that source file.

Checking Project>Properties>C/C++ General>Paths and Symbols>Includes I see all the project's include directories.

Ok, I've just gone out on a limb and added an `inc/` folder to the Source Location tab in the same properties page, and that seems to have fixed it. Refactoring in the header file works, and refactoring the source file updates the header file.

That's a little counter intuitive to me, though, as I now have a folder in my project marked as 'C', but it contains '.h' files. Am I missing something here?

Cheers

Radosław
Associate II
March 19, 2021

Exacly about this i was thinking, eclipse any source code operation do only on files in this type folders, this can be usefull.