-1

I have c++ project in visual studio, which in only ONE class IntelliSense is not able to resolve a couple of declared methods in the header file. So when I try to click "go to definition" IntelliSense does not open the source file, because he cannot find the definition of the method.

I tried already adding a cpp.hint file, with declaring macros used in these methods. In other classes this helped to solve the problem, but not for this class. I also deleted every time the ipch folder and the *.db file.

I already found out, that IntelliSense is able to resolve the first method declared after a public/protected/private specifier:
methods found by intelliSense

So switching the order helps IntelliSense to find it ... methods found by intelliSense

One BAD solution would be to add the public/protected/private specifier for every method, but you can imagine, that I don't want to do that. I am also working with Qt5, but I don't think this is the problem here. I also don't think that the problem relies in the code of the definitions, because it doesn't matter, which method stands first after the specifier.
Did someone already stumbled accross this kind of problem and knows how to solve it?

Thanks for all your sugesstions.

EDIT: It is definitly a Qt problem, when I comment out the Q_OBJECT definition in the class, IntelliSense can find all methods. Unfortunately, I can't compile my code without it.

RoQuOTriX
  • 2,871
  • 14
  • 25
  • What is this syntax? `public slots:` I haven't ever seen that before. Does the problem go away if you change it to just `public:`? – jwismar Jan 18 '19 at 13:45
  • @jwismar this is Qt specific syntax. I will try it without, but it is working in every other class – RoQuOTriX Jan 18 '19 at 13:47
  • Ah, OK, wasn't familiar with that. – jwismar Jan 18 '19 at 13:53
  • If anyone else is confused, I just came across this: https://stackoverflow.com/questions/9147636/qt-private-slots-what-is-this which discusses it. – jwismar Jan 18 '19 at 13:55

1 Answers1

0

So I was able to "solve" the problem.
I don't know why this happened, or why my "solution" solved it.
I had added temporarily a method for debugging, which was defined as the first method, before the constructor. The definition of this method was also in the header file.
When I switched this method below the constructor, IntelliSense started to working (again) in this class. Seems to be a bug with Qt and IntelliSense working together.

Old:
enter image description here

New:
enter image description here

RoQuOTriX
  • 2,871
  • 14
  • 25