How can I make KDevelop understand my template classes?
Milian Wolff
mail at milianw.de
Wed Mar 19 10:44:58 GMT 2014
On Wednesday 19 March 2014 10:20:08 Daniel Alves Paladim wrote:
> Exactly, Milian. I am talking about C++ template.
> For example, I have the following two files,
> *foo.h* (declaration)
> template <class T>
> class foo {
> foo();
> /*
> Declaration of the methods
> */};
> #include "foo.hpp
>
> *foo.hpp* (implementation)
> template <class T>
> foo<T>::foo)() {}
> /* and so on...*/
>
> Now, when I work with this setting, when I am editing foo.hpp, I don't have
> autocomplete anymore, the problems tab is full of errors. Is there no way
> to fix this without modifying foo.h and foo.hpp? Is there a way to give a
> hint to Kdevelop, so that he knows where the declaration of foo is?
Add an include guard to your foo.h and add a #include "foo.h" to your foo.hpp.
Otherwise there is no way for us to know that foo.hpp depends on foo.h
Bye
> 2014-03-19 9:41 GMT+00:00 Milian Wolff <mail at milianw.de>:
> > On Wednesday 19 March 2014 02:30:10 Aleix Pol wrote:
> > > On Tue, Mar 18, 2014 at 6:52 PM, Daniel Alves Paladim
> >
> > <daalpa at gmail.com>wrote:
> > > > Dear all,
> > > >
> > > > KDevelop seems to be unable to "understand" my template class if I
> >
> > divide
> >
> > > > it in 2 files the following way, one file for the class declaration
> > > > and
> > > > another file for the implementation (which is included in the first).
> >
> > This
> >
> > > > difficults working on the implementation file. I wonder if there is
> > > > any
> > > > way
> > > > to solve this problem without having to change the way I organize
> >
> > things.
> >
> > > Maybe you should take a look at
> > > kdevelop/file_templates/classes/qobject/.
> > > This one also uses different files.
> >
> > Or are you speaking about C++ template<typename Foo> stuff here? I think
> > so.
> >
> > In that case where does it brake? When editing the ".hpp" file which does
> > not
> > include the ".h" file? Without proper code snippets we are left in the
> > dark -
> > please give us an example code.
> >
> > Bye
> > --
> > Milian Wolff
> > mail at milianw.de
> > http://milianw.de
--
Milian Wolff
mail at milianw.de
http://milianw.de
More information about the KDevelop
mailing list