You must be registered to post a reply. Click here to register.
T O P I C R E V I E W
drzoom
Posted - Nov 07 2006 : 02:27:25 AM Preface: (C++) I'm still working trough old code and solving a lot of #include problems...
Topic: A feature would be nice, to add the correct #include for a given class or type.
Your objections:
It's not easy to find the right #include file, because many libraries are using "proxy" includes forwarding to the correct one.
How should we decide between a #include <foo.h> and a #include "foo.h" statement.
Unfortunately we are an add-in, and have to sneak around behind the IDE's back, so things that are easy when you control the IDE, ... ;-)
Some solutions:
The file, where a class is declared is the primary choice.
If this file is inside the project, a relative #include "../foo.h" is the best choice
If the file is external, but in the regular search path, a #include <foo.h> or #include <bar/foo.h> ist the best choice.
If the file is neither in the project, nor in the searchpath, but another file is including the target and the filename is matching the typename, this is the right choice (e.g for Qt/boost)
In other cases, no #include is added - or a list of possible alternatives is shown.
2 L A T E S T R E P L I E S (Newest First)
support
Posted - Jan 27 2009 : 10:38:10 PM case=226 is implemented in build 1715 Hover over an unrecognized symbol and choose "Add include xxxx" from the refactoring context menu.
feline
Posted - Nov 07 2006 : 08:04:26 AM This is already in the list You do make some interesting suggestions for how to do this, which I have added to the case.