简体   繁体   中英

Is it possible to get VsCode Intellisense to sense against source produced by the C preprocessor?

Say I have a C program that looks something like this...

#define Pointlike(type) \
    type lat;\
    type lng;
    
typedef struct Point {
    Pointlike(void*)
} Point;

typedef struct {
    Pointlike(int)
} IntPoint;

int main(){

    Point *point = &(Point){.lat = (void*) 0, .lng = (void*) 1};
    IntPoint *intPoint = &(IntPoint){ .lat = 0, .lng = 1 };
    IntPoint *unsafe = (IntPoint*) point;

    return 0;
}

Under my current configuration, VsCode Intellisense does not recognize the fields that would be provided by Pointlike .

Is there something I'm missing in my config? I could imagine this is the intended behavior because I wouldn't necessarily expect Intellisense to run the preprocessor by default. Is there a way for example to pipe gcc -E into Intellisense to somehow pick up these symbols?

In the latest version of C/C++ Intellisense, this appears to work out of the box.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM