C++ support doesn't work with std::vector

Andreas Pakulat apaku at gmx.de
Fri May 30 21:55:14 UTC 2008


On 30.05.08 22:41:24, David Nolden wrote:
> On Friday 30 May 2008 21:46:43 Andreas Pakulat wrote:
> > Ok, that was "easy" :) I hope I included really all necessary C++ code
> > so that it "should" be able to find out the return type.
> >
> > Its only 1 file now which I attached. As said in the comment on the at()
> > function directly using _Tp& or _Tp doesn't help to get code-completion
> > (or the C++ part to know what the return type of at() is).
> >
> > Hope that helps.
> >
> > Andreas
> 
> Wow that's a minimal example that I like. If you ever encounter problems in 
> C++ support, I'd love such examples. ;)
 
Will keep that in mind and it wasn't quite as hard as I thought it would
be (with all those templates and typedef's involved)

> However we have a problem: This file works perfectly for me! I can can 
> complete at "vec.at(0).|" and get the contents of Bar.

:(

> Are you really sure it doesn't work for you? Maybe you have fixed the problem 
> along the way while copying the stuff together, but haven't noticed?

Ha! Now I started KDevelop without any project loaded and opened just
that cpp and it works! Opening the projects afterwards and it still
works. However going back to loading KDevelop+KDevPlatform during
Kdevelop4 startup and a bunch of files it doesn't work anymore. To make
this clear the current workflow when it doesn't work is:

a) start kdev4, automatically loads kdevplatform+kdevelop and the files:
View 0=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxrunner/tests/proxymodelcommontest.cpp
View 1=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/xtestplugin.cpp
View 10=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxrunner/runnermodel.cpp
View 11=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxcppunit/cppunititem.cpp
View 12=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxcppunit/cppunitmodel.cpp
View 2=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxqtest/testrunner.cpp
View 3=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxqtest/testrunner.h
View 4=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxqtest/qtestxmlparser.cpp
View 5=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxqtest/qtestsuite.cpp
View 6=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxqtest/qtestsuite.h
View 7=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxcppunit/testrunner.cpp
View 8=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxcppunit/testrunner.h
View 9=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxrunner/runner.cpp

b) close all files, I notice kdevelop still does some parsing

c) go to the foo.cpp and open it, kdevelop parses, but this takes quite
a while, much longer than when I just open it from a bare-bone kdevelop
instance.

Then it doesn't work. It almost seems as if the combination of
pre-opened files and pre-opened projects has got something to do with
it. As soon as I disable either of the two (by commenting out the list
of files or the list of projects in kdeveloprc) it works again.

Hmm, I just noticed a lot of these (apparently as many as I have files
in the list):
QObject::connect: Cannot connect (null)::destroyed( QObject* ) to KDevelop::UseHighlightPlugin::documentDestroyed( QObject* )
QObject::connect: Cannot connect (null)::viewCreated( KTextEditor::Document* , KTextEditor::View* ) to KDevelop::UseHighlightPlugin::viewCreated( KTextEditor::Document*, KTextEditor::View* )

Yeah, it really looks like thats the cause of the problem, as I now
don't get the files opened (due to incomplete kdeveloprc) but I do get
those messages as I did before and I don't get autocompletion. My
kdeveloprc now just has this for my area layout:
,----
| [User Interface][Main Window 0][Area debug]
| View 0=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxrunner/tests/proxymodelcommontest.cpp
| View 1=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/xtestplugin.cpp
| View 10=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxrunner/runnermodel.cpp
| View 11=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxcppunit/cppunititem.cpp
| View 12=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxcppunit/cppunitmodel.cpp
| View 2=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxqtest/testrunner.cpp
| View 3=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxqtest/testrunner.h
| View 4=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxqtest/qtestxmlparser.cpp
| View 5=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxqtest/qtestsuite.cpp
| View 6=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxqtest/qtestsuite.h
| View 7=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxcppunit/testrunner.cpp
| View 8=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxcppunit/testrunner.h
| View 9=file:///home/andreas/KDE-work/4.0/kdevelop/plugins/xtest/qxrunner/runner.cpp
| View Count=13
| desired views=org.kdevelop.debugger.BreakpointsView:8,org.kdevelop.debugger.ConsoleView:8,org.kdevelop.debugger.StackView:8,org.kdevelop.debugger.VariablesView:1
| id=debug
| thickness bottom=-1
| thickness left=-1
| thickness right=-1
| thickness top=-1
| view on bottom=
| view on left=
| view on right=
| view on top=
`----

To re-iterate: There need to be 2 conditions met for me to hit this:
a) automatic loading of the kdevelop project (it turns out that with
just kdevplatform everythings ok and with just kdevelop I don't get
completion)
b) automatic loading of files (even if the files aren't really loaded,
its important that kdevelop tries and I get those connection errors)

As I said before, when I have these conditions kdevelop takes quite a
while with parsing/duchain-building (cpu-cooler spins up and the
progress bar goes up only slowly) when opening that single .cpp file

Andreas

-- 
In the stairway of life, you'd best take the elevator.




More information about the KDevelop-devel mailing list