How to let intellisense knows about non-self contain symbols in header files that
-
As below,
b.h
referencesclass A
ina.h
, butb.h
doesn't includea.h
directly but indirectly instead.
The code can be built successfully.
The problem is tht Qt Creator shows a warning forclass A
inb.h
, for it doesn't knowclass A
, and navigation toclass A
failed.
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.h
referencesclass A
ina.h
, butb.h
doesn't includea.h
directly but indirectly instead.
The code can be built successfully.
The problem is tht Qt Creator shows a warning forclass A
inb.h
, for it doesn't knowclass A
, and navigation toclass A
failed.
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 A
inb.h
, for it doesn't knowclass A
, and navigation toclass A
failed.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.cpp
manages with#include "a.h"
. I would expectb.h
to includea.h
.You could put
class A;
beforevoid test(A a);
intob.h
, so that it knowsA
is an external class, but I don't think it would help much.I don't see how you expect
b.h
to know aboutclass A
, or how to navigate to it etc., if you're not prepared to includea.h
into 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 A
inb.h
, for it doesn't knowclass A
, and navigation toclass A
failed.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.cpp
manages with#include "a.h"
. I would expectb.h
to includea.h
.You could put
class A;
beforevoid test(A a);
intob.h
, so that it knowsA
is an external class, but I don't think it would help much.I don't see how you expect
b.h
to know aboutclass A
, or how to navigate to it etc., if you're not prepared to includea.h
into 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 Studio
is smart enough to knowclass A
inb.h
in this case.But I think
#include "a.h"
inb.h
is the essential way.Thanks