How to let intellisense knows about non-self contain symbols in header files that
-
As below,
b.hreferencesclass Aina.h, butb.hdoesn't includea.hdirectly but indirectly instead.
The code can be built successfully.
The problem is tht Qt Creator shows a warning forclass Ainb.h, for it doesn't knowclass A, and navigation toclass Afailed.
How to fix the problem without adding#include <path\to\a.h>inb.h?a.h
class A { ... }b.h
void test(A a);b.cpp
#include "a.h" #include "b.h" void test(A a) { ... } -
As below,
b.hreferencesclass Aina.h, butb.hdoesn't includea.hdirectly but indirectly instead.
The code can be built successfully.
The problem is tht Qt Creator shows a warning forclass Ainb.h, for it doesn't knowclass A, and navigation toclass Afailed.
How to fix the problem without adding#include <path\to\a.h>inb.h?a.h
class A { ... }b.h
void test(A a);b.cpp
#include "a.h" #include "b.h" void test(A a) { ... }@jronald said in How to let intellisense knows about non-self contain symbols in header files that:
The problem is tht Qt Creator shows a warning for
class Ainb.h, for it doesn't knowclass A, and navigation toclass Afailed.Yes, that looks like correct behaviour to me.
How to fix the problem without adding
#include <path\to\a.h>inb.h?I would not expect you would need a path to
.a.h,b.cppmanages with#include "a.h". I would expectb.hto includea.h.You could put
class A;beforevoid test(A a);intob.h, so that it knowsAis an external class, but I don't think it would help much.I don't see how you expect
b.hto know aboutclass A, or how to navigate to it etc., if you're not prepared to includea.hinto it. -
@jronald said in How to let intellisense knows about non-self contain symbols in header files that:
The problem is tht Qt Creator shows a warning for
class Ainb.h, for it doesn't knowclass A, and navigation toclass Afailed.Yes, that looks like correct behaviour to me.
How to fix the problem without adding
#include <path\to\a.h>inb.h?I would not expect you would need a path to
.a.h,b.cppmanages with#include "a.h". I would expectb.hto includea.h.You could put
class A;beforevoid test(A a);intob.h, so that it knowsAis an external class, but I don't think it would help much.I don't see how you expect
b.hto know aboutclass A, or how to navigate to it etc., if you're not prepared to includea.hinto it.@JonB said in How to let intellisense knows about non-self contain symbols in header files that:
I don't see how you expect b.h to know about class A
Visual Studiois smart enough to knowclass Ainb.hin this case.But I think
#include "a.h"inb.his the essential way.Thanks